ANSWERS

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

QUESTION ONE

CREATE VIEW view_ceelasha_afgooye_bdate_students


AS
select *from students
where Address='Afgooye'
union all
select *from students
where Address='Ceelasha'

select * from view_ceelasha_afgooye_bdate_students

///////////////////////////////
////////////////////////////////

QUESTION TWO

create PROC sp_students_by_id


@StudentID int
AS
SELECT StudentID, Studentname,
studentAge,address,RegisterDate
FROM students
where StudentID=@StudentID
order by StudentName

EXECUTE sp_students_by_id '2'

/////////////////////////////////
//////////////////////////////

QUESTION THREE

create function sp_students_under_25()


returns table
as
return
select * from students
where StudentAge <25

select * from dbo.sp_students_under_25()

///////////////////////////////////////
////////////////////////////////////////

QUESTION FOUR
create proc sp_students_registered_in_2021
as
select * from students
where RegisterDate between '2021-0-0' and '2021-12-30'

exec sp_students_registered_in_2021

You might also like