in Databases edited by
804 views
0 votes
0 votes

Consider the following two tables named Raider and Team in a relational database maintained by a Kabaddi league. The attribute ID in table Team references the primary key of the Raider table, ID.

Raider
ID NameRaidsRaidPoints 
$1$Arjun$200$$250$
$2$Ankush$190$$219$
$3$Sunil$150$$200$
$4$Reza$150$$190$
$5$Pratham$175$$220$
$6$Gopal $193$$215$

 

Team
City ID BidPoints 
Jaipur$2$$200$
Patna$3$$195$
Hyderabad$5$$175$
Jaipur$1$$250$
Patna $4$$200$
Jaipur $6$$200$


The SQL query described below is executed on this database:
SELECT *
FROM Raider, Team
WHERE Raider.ID=Team.ID AND City="Jaipur" AND
RaidPoints > 200;

The number of rows returned by this query is $\_\_\_\_\_\_\_\_$.

in Databases edited by
by
804 views

2 Answers

0 votes
0 votes
Take cross product of both the tables with condition Raider.ID = Team.ID and then match them with City = "Jaipur" and RaidPoints > 200

We will get 3 rows

Therefore Ans: 3
0 votes
0 votes
IDNameRaidRaid PointCityBid Point
1ARJUN200250JAIPUR250
2ANKUSH190219JAIPUR200
3SUNIL150200PATNA195
4REZA150190PATNA200
5PRATHAM175220HYDERABAD175
6GOPAL193215JAIPUR200

The above table is the output of $RAIDER.ID=TEAM.ID$

From the above table find Raid Point$>200$ we get four tuples.

IDNameRaidRaid PointCityBid Point
1ARJUN200250JAIPUR250
2ANKUSH190219JAIPUR200
5PRATHAM175220HYDERABAD175
6GOPAL193215JAIPUR200

 Now in above table just find out tuples whose city is "JAIPUR", we get:

IDNameRaidRaid PointCityBid Point
1ARJUN200250JAIPUR250
2ANKUSH190219JAIPUR200
6GOPAL193215JAIPUR200

So given SQL query returns three tuples as output.

Related questions