retagged by
7,271 views
9 votes
9 votes

Consider the following table named $\text{Student}$ in a relational database. The primary key of this table is $\text{rollNum}.$

$\text{Student}$
$\begin{array}{|c|l|c|c|}
\hline \underline{\text{rollNum}} & \text{name} & \text{gender} & \text{marks} \\
\hline \hline 1 & \text{Naman} & \mathrm{M} & 62 \\
\hline 2 & \text{Aliya} & \mathrm{F} & 70 \\
\hline 3 & \text{Aliya} & \mathrm{F} & 80 \\
\hline 4 & \text{James} & \mathrm{M} & 82 \\
\hline 5 & \text{Swati} & \mathrm{F} & 65 \\
\hline
\end{array}$

The $\text{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 ___________.

retagged by

2 Answers

7 votes
7 votes

The output of the given SQL query is simply to return the female students whose marks is $>65$. we can also solve by first we retrieve all the female students then we can select marks $>65$.

ROll Name Marks Gender
$1$ Aliya 70 Female
$2$ Aliya 80 Female
$5$ Swati 65 Female

output is as follows:

Roll Name Marks Gender
$1$ Aliya 70 Female
$2$ Aliya 80 Female

So the output of the given query is $2$.

edited by
2 votes
2 votes

The output of the given SQL query is simply to return the female students whose marks is $>65$. we can also solve by first we retrieve all the female students then we can select marks $>65$.

ROll Name Marks Gender
$2$ Aliya 70 Female
$3$ Aliya 80 Female
$5$ Swati 65 Female

output is as follows:

Roll Name Marks Gender
$2$ Aliya 70 Female
$3$ Aliya 80 Female

So the output of the given query is $2$.

edited by
Answer:

Related questions

13 votes
13 votes
5 answers
3
39 votes
39 votes
5 answers
4
Arjun asked Feb 7, 2019
27,311 views
A relational database contains two tables Student and Performance as shown below:$$\overset{\text{Table: student}}{\begin{array}{|l|l|} \hline \text{Roll_no} & \text{Stud...