# SQL

 Question 1
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 ______
 A 0 B 1 C 2 D 3
GATE CSE 2023   Database Management System
Question 1 Explanation:
 Question 2
Consider the relational database with the following four schemas and their respective instances.

The number of rows returned by the above SQL query is ___
 A 1 B 2 C 4 D 8
GATE CSE 2022   Database Management System
Question 2 Explanation:

 Question 3
The relation scheme given below is used to store information about the employees of a company, where empId is the key and deptId indicates the department to which the employee is assigned. Each employee is assigned to exactly one department.

$\textsf{emp(\underline{\textsf{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
 A employees in the department B employees in the company C female employees in the department D female employees in the company
GATE CSE 2021 SET-2   Database Management System
Question 3 Explanation:
 Question 4
The SQL query
 SELECT columns
FROM TableA
RIGHT OUTER JOIN TableB
ON A.columnName = B.columnName
WHERE A.columnName IS NULL

returns the following:
 A All rows in Table B, which meets equality condition above and, none from Table A which meets the condition. B All rows in Table A, which meets equality condition above and none from Table B, which meets the condition. C All rows in Table B, which meets the equality condition D All rows in Table A, which meets the equality condition
ISRO CSE 2020   Database Management System
Question 4 Explanation:
NOTE: Question is excluded from the evaluation due to ambiguity.
 Question 5
Properties of 'DELETE' and 'TRUNCATE' commands indicate that
 A After the execution of 'TRUNCATE' operation, COMMIT, and ROLLBACK statements cannot be performed to retrieve the lost data, while 'DELETE' allow it B After the execution of 'DELETE' and 'TRUNCATE' operation retrieval is easily possible for the lost data C After the execution of 'DELETE' operation, COMMIT and ROLLBACK statements can be performed to retrieve the lost data, while TRUNCATE do not allow it D After the execution of 'DELETE' and 'TRUNCATE' operation no retrieval is possible for the lost data
ISRO CSE 2020   Database Management System
Question 5 Explanation:

There are 5 questions to complete.

### 4 thoughts on “SQL”

1. Ques 15; C should be the answer. Kindly check.