Database Management System
Q142.
Consider the following relations: Consider the following SQL query. The number of rows that will be returned by the SQL query is _____________.Q143.
Consider the relational database with the following four schemas and their respective instances.The number of rows returned by the above SQL query is ___Q144.
Consider the following relational schema: Employee (empId, empName, empDept ) Customer (custId,custName, salesRepId, rating) SalesRepId is a foreign key referring to empId of the employee relation. Assume that each employee makes a sale to at least one customer. What does the following query return? SELECT empName FROM employee E WHERE NOT EXISTS (SELECT custId FROM customer C WHERE C. salesRepId = E. empId AND C. rating < > 'GOOD')Q145.
Consider the following relational schema: Suppliers (sid:integer, sname:string, saddress:string) Parts (pid:integer, pname:string, pcolor:string) Catalog (sid:integer, pid:integer, pcost:real) What is the result of the following query? (SELECT Catalog.pid from Suppliers, Catalog WHERE Suppliers.sid = Catalog.sid) MINUS (SELECT Catalog.pid from Suppliers, Catalog WHERE Suppliers.sname <> 'Sachin' and Suppliers.sid = Catalog.sid)Q146.
Consider the following relations A, B and C: How many tuples does the result of the following SQL query contain? SELECT A.Id FROM A WHERE A.Age > ALL (SELECT B.Age FROM B WHERE B.Name = 'Arun')Q148.
Consider the following relational schema: 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 (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?Q149.
Which of the following statements are TRUE about an SQL query? P : An SQL query can contain a HAVING clause even if it does not have a GROUP BY clause Q : An SQL query can contain a HAVING clause only if it has a GROUP BY clause R : All attributes used in the GROUP BY clause must appear in the SELECT clause S : Not all attributes used in the GROUP BY clause need to appear in the SELECT clauseQ150.
A table 'student' with schema (roll, name, hostel, marks), and another table 'hobby' with schema (roll, hobbyname) contains records as shown below: \overset{\text{Table: student}}{\begin{array}{|c|c|c|c|} \hline \textbf{Roll} & \textbf {Name} & \textbf {Hostel} & \textbf{Marks} \\\hline \text{1798} & \text{Manoj Rathor} & \text{7} & \text{95} \\\hline \text{2154} & \text{Soumic Banerjee} & \text{5} & \text{68}\\\hline \text{2369} & \text{Gumma Reddy} & \text{7} & \text{86}\\\hline\text{2581} & \text{Pradeep pendse} & \text{6} & \text{92}\\\hline \text{2643} & \text{Suhas Kulkarni} & \text{5} & \text{78} \\\hline \text{2711} & \text{Nitin Kadam} & \text{8} & \text{72}\\\hline \text{2872}& \text{Kiran Vora} & \text{5} & \text{92}\\\hline\text{2926} & \text{Manoj Kunkalikar} & \text{5} & \text{94}\\\hline \text{2959}& \text{Hemant Karkhanis} & \text{7} & \text{88}\\\hline\text{3125} & \text{Rajesh Doshi} & \text{5} & \text{82}\\\hline \end{array}}\overset{\text{Table: hobby}}{}\\\begin{array}{|c|c|} \hline \textbf{Roll} & \textbf {Hobby Name} \\\hline \text{1798} & \text{chess} \\\hline \text{1798} & \text{music} \\\hline \text{2154} & \text{music} \\\hline \text{2369} & \text{swimming}\\\hline \text{2581} & \text{cricket} \\\hline \text{2643} & \text{chess}\\\hline\text{2643} & \text{hockey} \\\hline \text{2711} & \text{volleyball}\\\hline \text{2872} & \text{football} \\\hline \text{2926} & \text{cricket} \\\hline \text{2959} & \text{photography} \\\hline \text{3125} & \text{music}\\\hline \text{3125}& \text{chess}\\\hline \end{array} The following SQL query is executed on the above tables: select hostel from student natural join hobby where marks >= 75 and roll between 2000 and 3000; Relations S and H with the same schema as those of these two tables respectively contain the same information as tuples. A new relation S is obtained by the following relational algebra operation: S = \Pi_{\text{hostel}} ((\sigma_{s.roll = H.roll} (\sigma_{marks \gt 75\text{ and }roll \gt 2000\text{ and }roll \lt 3000} (S)) \times (H)) The difference between the number of rows output by the SQL statement and the number of tuples in S is