Question 32
Consider the schema Sailors(sid, sname, rating, age) with the following data
sid | sname | rating | age |
---|---|---|---|
22 | Dustin | 7 | 45 |
29 | Borg | 1 | 33 |
31 | Pathy | 8 | 55 |
32 | Robert | 8 | 25 |
58 | Raghu | 10 | 17 |
64 | Herald | 7 | 35 |
71 | Vishnu | 10 | 16 |
74 | King | 9 | 35 |
85 | Archer | 3 | 26 |
84 | Bob | 3 | 64 |
96 | Flinch | 3 | 17 |
For the query
SELECT S.rating, AVG(S.age) AS avgage FROM Sailors S Where S.age >= 18 GROUP BY S.rating HAVING 1 < (SELECT COUNT(*) FROM Sailors S2 where S.rating = S2.rating)
The number of rows returned is
Question 33
Select distinct A, B from R1, R2is guaranteed to be same as R1 provided one of the following condition is satisfied.
Question 34
select count(*) from ((select Employee, Department from Overtime_allowance) as S natural join (select Department, OT_allowance from Overtime_allowance) as T);
Question 35
Question 36
Suppliers(sid:integer, sname:string, city:string, street:string) Parts(pid:integer, pname:string, color:string) Catalog(sid:integer, pid:integer, cost:real)Consider the following relational query on the above database:
SELECT S.sname FROM Suppliers S WHERE S.sid NOT IN (SELECT C.sid FROM Catalog C WHERE C.pid NOT IN (SELECT P.pid FROM Parts P WHERE P.color<> \'blue\'))Assume that relations corresponding to the above schema are not empty. Which one of the following is the correct interpretation of the above query?
Question 37
Emp (Empcode, Name, Sex, Salary, Deptt)A simple SQL query is executed as follows:
SELECT Deptt FROM Emp WHERE sex = \'M\' GROUP by Dept Having avg (Salary) > {select avg (Salary) from Emp}The output will be
Question 38
SQ1 : SELECT * FROM One) EXCEPT (SELECT * FROM Two); SQ2 : SELECT * FROM One) EXCEPT ALL (SELECT * FROM Two);For each of the SQL queries, what is the cardinality (number of rows) of the result obtained when applied to the instances above ?
Question 39
Question 40
There are 66 questions to complete.