Question 51
emp(empId, name, gender, salary, deptId)Consider the following SQL query:
select deptId, count(*) from emp where gender = “female” and salary > (select avg(salary)from emp) group by deptId;The above query gives, for each department in the company, the number of female employees whose salary is greater than the average salary of
Question 52
Question 53
A library relational database system uses the following schema
USERS (User#, UserName, HomeTown) BOOKS (Book#, BookTitle, AuthorName) ISSUED (Book#, User#, Date)
Explain in one English sentence, what each of the following relational algebra queries is designed to determine
[caption width="800"] [/caption]Question 54
S1: A foreign key declaration can always be replaced by an equivalent check assertion in SQL. S2: Given the table R(a,b,c) where a and b together form the primary key, the following is a valid table definition. CREATE TABLE S ( a INTEGER, d INTEGER, e INTEGER, PRIMARY KEY (d), FOREIGN KEY (a) references R)Which one of the following statements is CORRECT?
Question 55
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`);
Question 56
Query1: select student from enrolled where student in (select student from paid) Query2: select student from paid where student in (select student from enrolled) Query3: select E.student from enrolled E, paid P where E.student = P.student Query4: select student from paid where exists (select * from enrolled where enrolled.student = paid.student)Which one of the following statements is correct?
Question 57
Borrower Bank_Manager Loan_Amount Ramesh Sunderajan 10000.00 Suresh Ramgopal 5000.00 Mahesh Sunderajan 7000.00What is the output of the following SQL query?
SELECT Count(*) FROM ( ( SELECT Borrower, Bank_Manager FROM Loan_Records) AS S NATURAL JOIN ( SELECT Bank_Manager, Loan_Amount FROM Loan_Records) AS T );
Question 58
Question 59
Student (rollno, name, address) Enroll (rollno, courseno, coursename)where the primary keys are shown underlined. The number of tuples in the Student and Enroll tables are 120 and 8 respectively. What are the maximum and minimum number of tuples that can be present in (Student * Enroll), where \'*\' denotes natural join ?
Question 60
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 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?
There are 66 questions to complete.