Test 4 SQL
Test 4 SQL
1. Consider the following tables Stationary and Consumer. Write SQL commands for the
statement (i) to (iv).
(i) Display the Trainer Name, City & Salary in descending order of their Hiredate.
(ii) To display the TNAME and CITY of Trainer who joined the Institute in the month of
December 2001.
(iii) To display TNAME, HIREDATE, CNAME, STARTDATE from tables TRAINER
and COURSE of all those courses whose FEES is less than or equal to 10000.
(iv) To display number of Trainers from each city.
(v) What is the degree and cardinality of the COURSE table?
7. Define referential integrity constraint.
8. Define attribute, domain and relation.
9. Write the queries for the i) to iv) based on the given tables.
i) To show firstname, lastname, address and city of all employees living in paris
ii) To display the content of Employees table in descending order of Firstname.
iii) To display the firstname, lastname and totalsalary of all managers from the tables
Employee and empsalary, where totalsalary is calculated as salary+benefits.
iv) To display the maximum salary among managers and clerks from the table
Empsalary.
v) What will be the degree and cardinality of the resultant table when Cartesian product
is performed on the tables-EmpSalary and Employees.
10. Consider the table CD and TYPE given below and answer the questions.
Table : CD
Table : Type
TABLE: ITEMTRAN