JOINS and SET Operations — Question 26
Back to all questionsConsider 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.
(i) No, the column 'PHONE' cannot be set as the primary key of the table "DRIVER" because it contains NULL values and primary keys must have unique, non-NULL values for each row.
Or
The primary key in the 'DRIVER' table is 'DRIVERID' because it uniquely identifies each driver, and it does not allow null values, ensuring that each row can be uniquely identified.
(ii) The data type used for the "PHONE" column is "CHAR", which is a fixed-length data type. "CHAR" pads the values with spaces to ensure each value takes up the same amount of storage space.
Or
The data type and size for the column "DRIVERID" would be "VARCHAR(4)" to accommodate the alphanumeric values of length 4.