0% found this document useful (0 votes)
8 views

Questions

The document contains a set of questions related to MySQL, focusing on concepts such as Foreign Keys, SQL clauses, and commands categorized as DDL or DML. It includes specific SQL query outputs based on a CHIPS table, as well as tasks related to a LIBRARY database and a STOCK table. The questions require explanations, SQL command writing, and analysis of database structures.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Questions

The document contains a set of questions related to MySQL, focusing on concepts such as Foreign Keys, SQL clauses, and commands categorized as DDL or DML. It includes specific SQL query outputs based on a CHIPS table, as well as tasks related to a LIBRARY database and a STOCK table. The questions require explanations, SQL command writing, and analysis of database structures.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

KVS Questions – MySQl

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.

(B) Write the command to view all tables in a database.

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?

(iii) Write the statements to:

(a) Insert the following record into the table

Stockid - 201, dateofpurchase – 18-OCT-2022, name – neckphone

Make – BoAT, price - 500

(b) Decrease the price of stock by 5% whose were purchased in year 2020

OR (Option for part iii only)

(iii) Write the statements to:

(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

You might also like