Question 1
SELECT Y FROM T WHERE X=7;
Question 2
Table: Passenger pid pname age ----------------- 0 Sachin 65 1 Rahul 66 2 Sourav 67 3 Anil 69 Table : Reservation pid class tid --------------- 0 AC 8200 1 AC 8201 2 SC 8201 5 AC 8203 1 SC 8204 3 AC 8202What pids are returned by the following SQL query for the above instance of the tables?
SLECT pid FROM Reservation , WHERE class ‘AC’ AND EXISTS (SELECT * FROM Passenger WHERE age > 65 AND Passenger. pid = Reservation.pid)
Question 3
Question 4
Q1 : Select e.empId From employee e Where not exists (Select * From employee s where s.department = “5” and s.salary >=e.salary) Q2 : Select e.empId From employee e Where e.salary > Any (Select distinct salary From employee s Where s.department = “5”)
Question 5
employees(emp-id, first-name, last-name, hire-date, dept-id, salary) departments(dept-id, dept-name, manager-id, location-id)You want to display the last names and hire dates of all latest hires in their respective departments in the location ID 1700. You issue the following query:
SQL> SELECT last-name, hire-date FROM employees WHERE (dept-id, hire-date) IN ( SELECT dept-id, MAX(hire-date) FROM employees JOIN departments USING(dept-id) WHERE location-id = 1700 GROUP BY dept-id);What is the outcome?
Question 6
select * from R where a in (select S.a from S)
Question 7
Query1: select A.customer, count(B.customer) from account A, account B where A.balance <=B.balance group by A.customer Query2: select A.customer, 1+count(B.customer) from account A, account B where A.balance < B.balance group by A.customerConsider these statements about Query1 and Query2.
1. Query1 will produce the same row set as Query2 for some but not all databases. 2. Both Query1 and Query2 are correct implementation of the specification 3. Query1 is a correct implementation of the specification but Query2 is not 4. Neither Query1 nor Query2 is a correct implementation of the specification 5. Assigning rank with a pure relational query takes less time than scanning in decreasing balance order assigning ranks using ODBC.Which two of the above statements are correct?
Question 8
A C ----- 2 4 3 4 4 3 5 2 7 2 9 5 6 4The set of all tuples that must be additionally deleted to preserve referential integrity when the tuple (2,4) is deleted is:
Question 9
select title from book as B where (select count(*) from book as T where T.price > B.price) < 5
Question 10
select distinct al, a2,........., an from r1, r2,........, rm where PFor an arbitrary predicate P, this query is equivalent to which of the following relational algebra expressions ? A: [Tex]\\prod_{a_{1},a_{2},...a_{n}}\\sigma_{\\rho} (r_{1}\\times r_{2}\\times r_{3}....\\times r_{m})[/Tex] B: [Tex]\\prod_{a_{1},a_{2},...a_{n}}\\sigma_{\\rho} (r_{1}\\bowtie r_{2}\\bowtie r_{3}....\\bowtie r_{m})[/Tex] C: [Tex]\\prod_{a_{1},a_{2},...a_{n}}\\sigma_{\\rho} (r_{1}\\cup r_{2}\\cup r_{3}....\\cup r_{m})[/Tex] D: [Tex]\\prod_{a_{1},a_{2},...a_{n}}\\sigma_{\\rho} (r_{1}\\cap r_{2}\\cap r_{3}....\\cap r_{m})[/Tex]
There are 66 questions to complete.