in Databases edited by
17,856 views
24 votes
24 votes

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{Student_name}\\\hline 1 & \text{Amit} \\\hline 2 & \text{Priya} \\\hline 3 & \text{Vinit} \\\hline 4 & \text{Rohan} \\\hline 5 & \text{Smita} \\\hline \end{array}} \qquad\overset{\text{Table: Performance}}{\begin{array}{|l|l|l|} \hline \text{Roll_no} & \text{Subject_code} & \text{Marks}\\\hline 1 & \text{A} & 86 \\\hline 1 & \text{B} & 95 \\\hline 1 & \text{C} & 90 \\\hline 2 & \text{A} & 89 \\\hline 2 & \text{C} & 92 \\\hline 3 & \text{C} & 80 \\\hline \end{array}}$$

The primary key of the Student table is Roll_no. For the performance table, the columns Roll_no. and Subject_code together form 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 ________

in Databases edited by
by
2441 3624 5537
17.9k views

5 Comments

@Ahabnnc @Deepanshu

What is answer for inherited sttribute ques ??

Q 53

And what is answer for GA question on directions ??

Q7

0
0
  1. where clause returns 

now group by 

 

0
0
arjun sir pls reply
0
0

That is on natural join, here cross product is considered as join condition is not given.

0
0

Subscribe to GO Classes for GATE CSE 2022

4 Answers

31 votes
31 votes
 
Best answer
Group by Student_name $\implies$ number of distinct values of Student_name

in the instance of the relation all rows have distinct name then it should results $5$ tuples !
edited by
by
35 104 555

5 Comments

is this true really ??
0
0
If let’s say I have two tables and they have same attribute name and can apply natural join but cross product is given, in that case do we still apply cross product? And For the natural join are they always going to mention explicitly?
0
0
best solution
0
0
In the link given question there is condition given so it is natural join. But in the given question we consider as cross product.

Hope you understand.
0
0
18 votes
18 votes
5 rows

Comma by default means cross product not natural join
by
1 5 15

5 Comments

2.

If u do cross product it would break the given primary key constraints given.ans will be 2 only
8
8
By default if common attributes r there it acts like a natural join
1
1

@Manoj Kumar Pandey

even though there are common attributes it doesn't perform natural join !

2
2
Why not? I didn’t understand the concept.
0
0
For natural join it will be explicitly mentioned or we have to assume in case of same attribute name?
0
0
6 votes
6 votes
Remember this basic rule in sql

SELECT= PROJECTION

FROM= CROSS PRODUCT

WHERE= SELECT CONDITION

here in the given query we need to take cross product which returns 25 query with keeping in mind the condition to jave marks > 84 so when we group by our answer would be

Amit 452

Priya 452

Vinit 452

Roshan 452

Smita 452

So 5 tuples
by
1 1 3
4 votes
4 votes
was it 5 I don't remember exactly. But relation Algebra was 1
by
2 3 7

5 Comments

68 😣
0
0
From where did you calculate ? Response sheet or answer key pushed ?
0
0
Good Ahbanc u will be in top २०० for sure if luck favour's u will be in top १०० , I am going down one by one , Silly mistakes of calculating combination,divide etc. ruined my exam 😑
0
0
Lets see, Even I don't know all the answers. Depends on the final answer key. Everything can change. Also, it seems this time top rankers will have very high marks so less chances it seems.
0
0
Answer:

Related questions