Informatics Practices
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 |
SQL Joins & Grouping
1 Like
Answer
SELECT D.Divno
FROM Division D
LEFT JOIN Member M ON D.Divno = M.Divno
WHERE M.Divno IS NULL;
Output
+-------+
| Divno |
+-------+
| 30 |
+-------+
Answered By
2 Likes
Related Questions
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 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 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 Consider the following tables TRANSPORTER and DRIVER and answer the questions that follow :
Table : TRANSPORTER
ORDERID ITEM TRANSPORTDATE DESTINATION DRIVERID 1120 TELEVISION 2019-03-19 MUMBAI D103 1121 REFRIGERATOR 2019-04-12 UDAIPUR D101 1122 TELEVISION 2019-05-06 MUMBAI D101 1123 MICROWAVE 2019-05-07 KANPUR D103 1124 FURNITURE 2019-06-15 KANPUR D102 Table : DRIVER
DRIVERID DRIVERNAME DRIVERGRADE PHONE D101 Radhey Shyam A 981234567 D102 Jagat Singh 981017897 D103 Timsy Yadav B D104 Zoravar Singh A 981107887 (i) Can the column 'PHONE' be set as the primary key of the table DRIVER ? Give reason(s).
Or
Identify the Primary key in the table 'DRIVER'. Give reason(s) for your choice.
(ii) In the PHONE column of "DRIVER" table, each phone number is taking same number of bytes (being padded with spaces to specified length) irrespective of the number of characters actually stored in that column. Which data type has been used for PHONE column ?
Or
Identify data type and size to be used for column DRIVERID.