Consider the following database tables of a sports league. player(pid,pname,age) team(tid,tname,city,cid) An instance of the table and an SQL query are given. Player Coach Team Members The value returned by the given SQL query is ______ . (Answer in integer)
coach(cid,cname) members(pid,tid)pid pname age 1 Jasprit 31 2 Atharva 24 3 Ishan 26 4 Axar 30 cid cname 101 Ricky 102 Mark 103 Trevor tid tname city cid 10 MI Mumbai 102 20 DC Delhi 101 30 PK Mohali 103 pid tid 1 10 2 30 3 10 4 20 SELECT MIN(P.age)
FROM player P
WHERE P.pid IN (
SELECT M.pid
FROM team T, coach C, members M
WHERE C.cname = 'Mark'
AND T.cid = C.cid
AND M.tid = T.tid
);
The provided SQL query is designed to find the minimum age of players who belong to a team coached by someone named "Mark". Let's break down the SQL query to find the correct result.
1. Identify Mark's Coach ID:
The coach table shows:
| cid | cname |
|---|---|
| 101 | Ricky |
| 102 | Mark |
| 103 | Trevor |
The cid for Mark is 102.
2. Find Teams Coached by Mark:
Using the team table, we identify teams coached by Mark:
| tid | tname | city | cid |
|---|---|---|---|
| 10 | MI | Mumbai | 102 |
| 20 | DC | Delhi | 101 |
| 30 | PK | Mohali | 103 |
The team with cid 102 is MI (tid 10).
3. Identify Players in Team MI:
Using the members table, find players in team with tid 10:
| pid | tid |
|---|---|
| 1 | 10 |
| 2 | 30 |
| 3 | 10 |
| 4 | 20 |
Players with pid 1 and 3 are in team MI.
4. Determine Ages of these Players:
Using the player table:
| pid | pname | age |
|---|---|---|
| 1 | Jasprit | 31 |
| 2 | Atharva | 24 |
| 3 | Ishan | 26 |
| 4 | Axar | 30 |
Player with pid 1 is Jasprit, aged 31.
Player with pid 3 is Ishan, aged 26.
5. Find Minimum Age:
The minimum age among players pid 1 and 3 is 26.
6. Verification:
The range provided is (26,26). The computed value 26 is within this range.
Therefore, the value returned by the SQL query is 26.
Let Account be a relation as shown.
Account
| AccNo | Balance |
|---|---|
| A1 | 5000 |
| A2 | 5000 |
| A3 | 10000 |
| A4 | 15000 |
| A5 | 18000 |
Consider the given SQL query.
SELECT AccNo FROM Account AS A
WHERE (SELECT COUNT(*) FROM Account AS B
WHERE A.Balance < B.Balance) >= (SELECT COUNT(*)
FROM Account AS C WHERE A.Balance > C.Balance)
The number of rows returned by the SQL query is __________ . (Answer in integer)
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 | Name | Raids | RaidPoints |
| 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 ________.
On a relation named Loan of a bank:
| LOAN | ||
|---|---|---|
| loan_number | branch_name | amount |
| L11 | Banjara Hills | 90000 |
| L14 | Kondapur | 50000 |
| L15 | SR Nagar | 40000 |
| L22 | SR Nagar | 25000 |
| L23 | Balanagar | 80000 |
| L25 | Kondapur | 70000 |
| L19 | SR Nagar | 65000 |
the following SQL query is executed.
SELECT L1.loan_number
FROM Loan L1
WHERE L1.amount > (SELECT MAX (L2.amount)
FROM Loan L2
WHERE L2.branch_name = 'SR Nagar');
The number of rows returned by the query is ____________ (Answer in integer)
Which of the following is NOT a Structured Query Language Data type?