here is my question with getdate function
--12. List the names and staff number for staff who manage detached properties that have a current lease i.e. there is a lease and its end date is in the future. Show each staff member only once
-- (Hint the getdate() function returns todays date)
i have this so farr
select fname, lname, s.staffno from staff s inner join property p
on s.staffno = p.staffno inner join lease l
on p.propertyno = l.propertyno
where type = 'detached'
where do i insert the getdate function (btw the current lease is called enddate)
And for question 4
Count the unleased properties assigned to each staff member who is employed at branch in Ottawa.. Sequence the output by highest to lowest count.
NOTE . A property is unleased if there is no lease or the lease has expired (End date is before current date . Hint getdate() function)
select count(leaseno) as 'unleashed properties assigned to staff in ottawa' from lease where propertyno in
(select distinct propertyno from property where staffno in
(select distinct staffno from staff where branchno in
(select distinct branchno from branch where type = 'ottawa')));
--12. List the names and staff number for staff who manage detached properties that have a current lease i.e. there is a lease and its end date is in the future. Show each staff member only once
-- (Hint the getdate() function returns todays date)
i have this so farr
select fname, lname, s.staffno from staff s inner join property p
on s.staffno = p.staffno inner join lease l
on p.propertyno = l.propertyno
where type = 'detached'
where do i insert the getdate function (btw the current lease is called enddate)
And for question 4
Count the unleased properties assigned to each staff member who is employed at branch in Ottawa.. Sequence the output by highest to lowest count.
NOTE . A property is unleased if there is no lease or the lease has expired (End date is before current date . Hint getdate() function)
select count(leaseno) as 'unleashed properties assigned to staff in ottawa' from lease where propertyno in
(select distinct propertyno from property where staffno in
(select distinct staffno from staff where branchno in
(select distinct branchno from branch where type = 'ottawa')));
Comment