InterviewSolution
Saved Bookmarks
| 1. |
In a database there are two tables'CD' and 'TYPE' as shown below : Table : CDCodeTitleDurationSingerCategory101Sufi Songs50 minZakir Faiz12102Eureka45 minShyama Mukherjee12103Nagmey23 minSonvi kumar77104Dosti35 minBobby1 Table : TypeCategoryDescription1Jazz12Classical40Country Side78Pop(i) Name the Primary key in "CD" table.(ii) Name the foreign key in "CD" table.(iii) Write the Cardinality and Degree of "TYPE" table.(iv) Check every value in CATEGORY column of both the tables. Do you find any discrepancy ? State the discrepancy.(v) Write SQL statement to change the name of Singer "Sonvi Kumar" to "Sonvi Mehra" in all the places wherever it occurs in CD table.(vi) Write MySQL statement to add a column "Music_Director" which datetype Varchar and size as 30 in the table "CD".(vii) Write command in SQL to display code, Title and corresponding description of all the CDs. |
|
Answer» (i) Code (ii) Category (iii) Cardinality : 4 Degree : 2 (iv) Category 77 is not present in Category table. R-eferential integrity doesn't exist. (v) UPDATE CD SET Singer='Sonvi Mehra' where Singer like 'Sonvi kumar'; (vi) ALTER TABLE CD ADD COLUMN Music _Director Varchar(30); (vii) SELECT CODE, TITLE, DESCRIPTION FROM CD, TYPE WHERE CD.CATEGORY = TYPE CATEGORY; |
|