Questions
Questions
Paper-1
1) Explain the use of ‘Foreign Key’ in a Relational Database Management System. Give example
to support your answer.
2) Differentiate between order by and group by clause in SQL with appropriate example.
3) Categorize the following commands as DDL or DML: INSERT, UPDATE, ALTER, DROP.
4) Write the output of the queries (i) to (vi) based on the table given below:
(i) Select BRAND_NAME, FLAVOUR from CHIPS where PRICE <> 10;
(ii) Select * from CHIPS where FLAVOUR=”TOMATO” and PRICE > 20;
(iii) Select BRAND_NAME from CHIPS where price > 15 and QUANTITY < 15; Select
count( distinct (BRAND_NAME)) from CHIPS;
(iv) Select price , price *1.5 from CHIPS where FLAVOUR = “PUDINA”;
(v) Select distinct (BRAND_NAME) from CHIPS order by BRAND_NAME desc;
5) (A) Consider the following tables BOOKS and ISSUED in a database named “LIBRARY”.
Write SQL commands for the statements (i) to (iv).
(i) Display book name and author name and price of computer type books.
(ii) To increase the price of all history books by Rs 50.
(iii) Show the details of all books in ascending order of their prices.
(iv) To display book id, book name and quantity issued for all books which have been
issued.
6) Layna creates a table STOCK to maintain computer stock in Vidyalaya. After creation of the
table, she has entered data of 8 items in the table.
Based on the data given above answer the following questions:
(i) Identify the most appropriate column, which can be considered as Primary key.
(ii) If three columns are added and 5 rows are deleted from the table stock, what will be
the new degree and cardinality of the above table?
(b) Decrease the price of stock by 5% whose were purchased in year 2020
(a) Delete the record of stock which were purchased before year 2015.
(b) Add a column STATUS in the table with datatype as char with 1 characters