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

Name Umair Fazal

Class MCS-2A
Assignment Database Management System
ARID No 20-ARID-417

1. Display full name of all employees whose city is RWP.


Π fname, lname (σ city= ‘rwp’ (employees))

2. Display details of those authors whose name is either Ali or Rida or Javed
without using comparison/relational operator.
σ name IN (‘ali’, ‘rida’, ‘javed’) (author)

3. Display details of all those authors whose salary is less than 25000 or salary
greater than 30000 using between operator.
σ salary NOT BETWEEN 25000 AND 30000 (employees)

4. Display details of all those male authors who are living in isb or lhr.
σ gender=’male’ AND city IN (‘isb’,’lhr’) (author)

5. Display details of all those employees whose fname is neither akram nor asif
nor ahmed without using in operator.
σ fname != ‘akram’ AND fname != ‘asif’ AND fname != ‘ahmed’ (employee)

6. Display details of all those employees whose lname starts with a and whose
fname second letter is a vowel character i.e. (a,e,i,o,u).

σ lname LIKE ‘a%’ AND (fname LIKE ‘_a%’ OR fname LIKE ‘_e%’ OR fname LIKE ‘_i%’ OR fname
LIKE ‘_o%’ OR fname LIKE ‘_u%’ (employee)

7. Display details of all those authors whose name contains less than 5
characters.
σ { length (name) < 5 } (author)

8. Display fname of 3 employees who are earning least.


Π fname (ORDER BY ℑsalary (σ {LIMIT 3}) (employee))
9. Display details of all authors in such a way that female authors are shown
before the male authors.
Π (ORDER BY ℑgender (author))

10. Display the unique cities from author table.

Π city (DISTINCT ℑcity (author))

11. Display details of all those employees who are getting salary greater than
50000 or whose city is ISB.
σ salary > 50000 OR city = ‘isb’ (employee)

12. Display details of all those authors whose age is less than equal to 50 and
age is greater than equal to 20 without using relational operators i.e. (>=, <=)
σ age BETWEEN 20 AND 50 (author)

13. Display all authors.

Π name (author)

14. Display details of all those employees whose salary is between 20000 and
30000 without using between operator.
σ salary >= 20000 AND salary <= 30000 (employee)

15. Display details of all those authors whose city is either rwp or isb using in
operator, in such a way that youngest author should be shown at the top.
ORDER BY ℑage (σ {city IN (‘rwp’,’isb’)} (employee))

You might also like