You are on page 1of 3

Vidyasthali Public School

Affiliated to CBSE, New Delhi

Time : 2 Hour Class : - XII P.A (2021-22) Sub : - IP M.M. 40

Section--A
Q.1)What is MySQL? (2)
Q.2)What is the diference between degree and cardinality? (2)
Q.3)What is the difference between DDL and DML commands? (2)
Q.4) What is the use of order by clause? (2)
Q.5)What is the difference between alter and update command? (2)
Q.6)State difference between date functions NOW( ) and SYSDATE( ) of MySql. (2)
Section B

Q.1)Consider the following table:


Table: Stock
ItemNo Item Dcode Qty UnitPrice StockDate
5005 Ball Pen 0.5 102 100 16 28-3-2010
5003 Ball pen 0.25 102 150 20 01-01-2010
5002 Gel pen 101 125 14 14-2-2010
Premium
5006 Gel pen Classic 101 200 22 01-01-2009
5001 Eraser small 102 210 5 19-03-2009
5004 Eraser Big 102 60 10 12-12-2009
5009 Sharpener 103 160 8 23-01-2009
Classic

Write SQL commands for the following statements:

(1)Write a create table command of the above table. (1)


(2)Write a insert command. (1)
(3)To display details of all items in the Stock table in ascending order of stockdate.
(1)
(4)To display the details of those items whose dealer code(dcode) is 102 or quantity
in stock (qty)is more than 100 from the table. (1)
(5)To display itemno,and item name of those items from table whose unitprice is
more than 15.(1)
(6)To display maximum unitprice of items from the table. (1)
(7)To increase the unitprice by 10 whose itemno is 5006. (1)
(8)Write a query to display all records whose item name contain “pen”.
(1)
(9)Write a command to display structure of a table. (1)
(10)To add a new record with the following content: (1)
5010, ‘sharpner’, 106,60, 30, ’2-7-2010’
(11)Write a command to add new column price int(3). (1)
(12)Write a command to delete any record from the table. (1)
(13)Write a query to display the number of item with same dcode. (1)
(14)To display sum of unitprice for each type of items. (1)
(15)To display name of item,qty,price in ascending order of their unitprice. (1)
Section--C
Q.1) Write the output of the following SQL queries: (4)
a)SELECT ROUND(6.5675, 2);
b)SELECT TRUNCATE(5.3456, 1);
c)SELECT DAYOFMONTH('2009-08-25');
d)SELECT MID('Class 12', 2,3);
Q.2) Write the output of the following SQL queries : (2)
(1) SELECT INSTR(“UNICODE‟,‟CO‟);
(2) SELECT RIGHT(“Informatics‟,3);
Q.3) Write the output of the following SQL queries: 1
SELECT POW(INSTR(„My_Database‟,‟_‟),2);
Q.4)Ms gupta is working on a MySQL table named ‘Hotel’ having following structure:
(6)
She needs to perform the following task in the table:
1. To fetch last 2 character from the job column.
2. To display the values of ename column in lower case.
3. To display 3 character from 3 rd place from the column job.
4. To display length of column ename
5. To fetch starting 4 character from the ename column.
6. To display the year of hiredate of all employess from the hiredate column

You might also like