in Databases edited by
1,529 views
1 vote
1 vote

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 ___________.

in Databases edited by
by
1.5k views

4 Comments

$\color{\red}{\text{DBMS:}}$

Question 1: Degree(Arity) of a Relation

Question 2: SQL question Number of Tuples

Question 3: Primary Index on Data File, Binary Search

0
0
By the way, that is not age as per the question in the examination. That is actually the marks obtained by the students. Using Age here makes the question unintentionally funny.
0
0

@Vishal_kumar98 Haha, Corrected. 

0
0

The correct answer is 2

2
2

2 Answers

3 votes
3 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
1 vote
1 vote

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