Vous êtes sur la page 1sur 2

19th April11 SQL QUERIES ASSIGNMENT

TABLENAME: PRODUCT_MASTER PROD_NO Varchar2(10) P001 P002 P00345 P00987 P000876 QUESTIONS: 1) Create the table PRODUCT_MASTER 2) Insert following data into the table. 3) Retrieve the entire contents of the Relation PRODUCT_MASTER. 4) Retrieve the list of PROD_NO, DESCRIPTION and SELL_PRICE from the relation. 5) List the products whose SELL_PRICE is greater than 700. 6) Change the DESCRIPTION of Product to Blazers where the PROD_NO is P000876. 7) Change the COST_PRICE of Belts to 750. 8) Delete all records where COST_PRICE=400. 9) Add a column PROFIT to the Relation. 10) Destroy the Relation 11) Rename the table as PRODUCT_DETAILS 12) Delete all the records keeping the structure intact. DESCRIPTION Varchar2(15) T-shirt Shirt Jeans Belts Jackets PROFIT_PERCENT Number(5,2) 5 6 8 9 8 QTY_ON_HAND Number(5) 300 400 150 250 300 SELL_PRICE Number(8) 350 500 850 300 950 COST_PRICE Number(8) 250 400 700 200 850

20th April11 SQL QUERIES ASSIGNMENT

TABLENAME: SALESMAN_MASTER SALESMAN_NO Varchar2(10) S001 S123 S234 S345 S455 QUESTIONS: 1) Create the table SALESMAN_MASTER 2) Insert following data into the table. 3) Retrieve the entire contents of the Relation SALESMAN_MASTER 4) Retrieve the list of SALESMAN_NAME , ADDRESS from the relation. 5) List the names of the salesman whose SALES_AMT is greater than 7000. 6) Change the ADDRESS of SALESMAN to 233,SEC-4 where the SALESMAN_NO is S123. 7) Delete all records where STATE IS HIMACHAL. 8) Add a column PHONE_DETAILS to the Relation. 9) Delete all the records keeping the structure intact. 10) Rename the table as SALESMAN_DETAILS 11) Destroy the Relation. 12) DROP column PINCODE From SALESMAN_MASTER. 13) Modify the data size of the column address to 30. 14) GRANT ALTER Permission to user VARUN 15) REVOKE ALL permission from ANSHUL. SALESMAN_NAME Varchar2(15) Sanjay Amit Varun Vishesh Anshul ADDRESS Varchar2(15) 123,sec-2,JJ colony 234,sec-4 221,sec-5 Sec-34,near New colony 1234,sec-51 STATE Number(15) Haryana UP Himachal Orissa Punjab PINCODE Number(8) 122001 12345 1333545 34556 565748 SALES_AMT Number(8,2) 3400.00 5600.88 4647.96 8686.50 6565.00