Informatics Practices
Write a SQL query to display all the divnos in Member table but not in the Division table.
Table : Member
EmpId | Name | Pay | Divno |
---|---|---|---|
1001 | Shankhya | 34000 | 10 |
1003 | Ridhima | 32000 | 50 |
1002 | Sunish | 45000 | 20 |
Table : Division
Divno | Divname | Location |
---|---|---|
10 | Media | TF02 |
20 | Dance | FF02 |
30 | Production | SF01 |
SQL Joins & Grouping
3 Likes
Answer
SELECT m.Divno
FROM Member m
LEFT JOIN Division d ON m.Divno = d.Divno
WHERE d.Divno IS NULL;
Output
+-------+
| Divno |
+-------+
| 50 |
+-------+
Answered By
3 Likes
Related Questions
Write a SQL query to display all the divnos from both the tables.
Table : Member
EmpId Name Pay Divno 1001 Shankhya 34000 10 1003 Ridhima 32000 50 1002 Sunish 45000 20 Table : Division
Divno Divname Location 10 Media TF02 20 Dance FF02 30 Production SF01 Write a SQL query to display all the distinct divnos from both the tables.
Table : Member
EmpId Name Pay Divno 1001 Shankhya 34000 10 1003 Ridhima 32000 50 1002 Sunish 45000 20 Table : Division
Divno Divname Location 10 Media TF02 20 Dance FF02 30 Production SF01 Write a SQL query to display all the divnos in Division table but not in the Member table.
Table : Member
EmpId Name Pay Divno 1001 Shankhya 34000 10 1003 Ridhima 32000 50 1002 Sunish 45000 20 Table : Division
Divno Divname Location 10 Media TF02 20 Dance FF02 30 Production SF01 Write a SQL query to display common divnos from both the tables.
Table : Member
EmpId Name Pay Divno 1001 Shankhya 34000 10 1003 Ridhima 32000 50 1002 Sunish 45000 20 Table : Division
Divno Divname Location 10 Media TF02 20 Dance FF02 30 Production SF01