SQL commands
SQL commands
SQL WORKSHEET
2. Write the SQL commands for (i) to (ii) and outputs for (iii) to (vi) on the basis of tables BOOKS and
ISSUES
Table: BOOKS
Table: ISSUES
Book_ID Qty_Issued
L02 13
L04 5
L05 21
(i) To display Book name, Author name and Price of books of ABC publisher.
(ii) To display the details of the books in descending order of their price.
(v) SELECT Price from Books, Issues where Books.Book_ID=Issues.Book_ID AND Qty_Issued=5;
(i) To display NAME and POST of those members whose grade is either D002 or D003
(ii) To display the details of all members of organisation in descending order of DOJ.
(iii) To add a new row with the following 2007,’Rudra’,’sales incharge’,’d002’,’19-10-1987’;
(iv) SELECT COUNT(SGRADE), SGRADE FROM organisation GROUP BY SGRADE;
(v) SELECT MIN(salary),MAX(Salary) from organisation;
4. Consider the following tables EMPLOYEES and EMPSALARY. Write SQL commands for the statements
(i) to (ii) and give outputs for SQL queries (iii) to (iv)
(i) To display Firstname,Lastname,address and city of all employees living in paris from the table
EMPLOYEES.
(ii) To display the content of EMPLOYEES table in descending order of Firstname
5. Consider the following tables SCHOOL and ADMIN. Write SQL commands for the statements (i) to (iv)
and give the outputs for SQL queries (v) to (viii)