SQL
Q1.
Consider the following table named Student in a relational database. The primary key of this table is rollNum.\begin{array}{|c|c|c|c|} \hline \\ rollNum&name&gender&marks \\ \hline 1&Naman&M&62\\ \hline 2&Aliya&F&70 \\ \hline 3&Aliya &F&80 \\ \hline 4&James&M&82\\ \hline 5&Swati&F&65\\ \hline \end{array} The SQL query below is executed on this database. SELECT * FROM Student WHERE gender = 'F' AND marks > 65; The number of rows returned by the query is ______Q2.
A relational database contains two tables Student and Performance as shown below: The primary key of the Student table is Roll_no. For the Performance table, the columns Roll_no. and Subject_code together from the primary key. Consider the SQL query given below: SELECT S.Student_name, sum(P.Marks) FROM Student S, Performance P WHERE P.Marks > 84 GROUP BY S.Student_name;The number of rows returned by the above SQL query is _________ .Q3.
\begin{array}{|l|l|l|l|l|} \hline \textbf{Employee} & \textbf{Department} & \textbf{OT allowance} \\ \hline \text{RAMA} & \text{Mechanical} & \text{5000} \\\hline \text{GOPI} & \text{Electrical} & \text{2000} \\\hline \text{SINDHU} & \text{Computer} & \text{4000} \\\hline \text{MAHESH} & \text{Civil} & \text{1500} \\\hline \end{array}What is the output of the following SQL query? select count(*) from ((select Employee, Department from Overtime_allowance) natural join (select Department, OT_allowance from Overtime_allowance) as T);Q4.
Consider the following two tables and four queries in SQL. Which one of the queries above is certain to have an output that is a superset of the outputs of the other three queries?Q5.
The relation book (title,price) contains the titles and prices of different books. Assuming that no two books have the same price, what does the following SQL query list? select title from book as B where (select count(*) from book as T where T.price>B.price) < 5Q6.
Consider a database that has the relation schema EMP (EmpId, EmpName, and DeptName). An instance of the schema EMP and a SQL query on it are given below. The output of executing the SQL query is _____.Q7.
Consider the following database table named water_schemes : The number of tuples returned by the following SQL query is __________.Q9.
Given relations R(w,x) and S(y,z), the result ofSELECT DISTINCT w,xFROM R,Sis guaranteed to be same as R, ifQ10.
Consider the following database table named top_scorer. Consider the following SQL query: The number of tuples returned by the above SQL query is ___________.