(a) What is the purpose of a key in a table? Give an example of a key in a table. [2] b) Consider the following table DRESS and MATERIAL. Write SQL commands for the statements (i) to (iv) and give outputs for SQL queries (v) to (viii). [ 6] Table: DRESS DCODE DESCRIPTION PRICE MCODE 10001 FORMAL SHIRT 1250 M001 12-JAN-08 10020 FROCK 750 M004 09-SEP-07 10012 INFORMAL SHIRT 1450 M002 06-JUN-08 10019 EVENING GOWN 850 M003 06-JUNE-08 10090 TULIP SKIRT 850 M002 31-MAR-07 10023 PENCIL SKIRT 1250 M003 19-DEC-08 10089 SLACKS 850 M003 20-OCT-08 10007 FORMAL PANT 1450 M001 09-MAR-08 10009 INFORMAL PANT 1400 M002 20-OCT-08 10024 BABY TOP 650 M003 07-APR-07 Table : MATERIAL MCODE TYPE M001 TERELENE M002 COTTON M004 POLYESTER M003 SILK (i) To display DCODE and DESCRIPTION of each dress in ascending order of DCODE.
(a) What is the purpose of a key in a table? Give an example of a key in a table. [2] b) Consider the following table DRESS and MATERIAL. Write SQL commands for the statements (i) to (iv) and give outputs for SQL queries (v) to (viii). [ 6] Table: DRESS DCODE DESCRIPTION PRICE MCODE 10001 FORMAL SHIRT 1250 M001 12-JAN-08 10020 FROCK 750 M004 09-SEP-07 10012 INFORMAL SHIRT 1450 M002 06-JUN-08 10019 EVENING GOWN 850 M003 06-JUNE-08 10090 TULIP SKIRT 850 M002 31-MAR-07 10023 PENCIL SKIRT 1250 M003 19-DEC-08 10089 SLACKS 850 M003 20-OCT-08 10007 FORMAL PANT 1450 M001 09-MAR-08 10009 INFORMAL PANT 1400 M002 20-OCT-08 10024 BABY TOP 650 M003 07-APR-07 Table : MATERIAL MCODE TYPE M001 TERELENE M002 COTTON M004 POLYESTER M003 SILK (i) To display DCODE and DESCRIPTION of each dress in ascending order of DCODE.