0% found this document useful (0 votes)
29 views2 pages

STD XII-SQL UPDATED For Board

Uploaded by

psb6950
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views2 pages

STD XII-SQL UPDATED For Board

Uploaded by

psb6950
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CHETTINAD VIDYASHRAM

STD 12- UPDATED SQL - (2024-25)

1. Write SQL commands for the questions given below using STUDENT table .
--------------------------------------------------------------------------------------------------------------
ROLL NAME STIPEND STREAM AVGMARK GRADE
--------------------------------------------------------------------------------------------------------------
101 Karan 400 Medical 78.5 B
102 Divakar 450 Commerce 89.2 A
103 Divya 300 Commerce 68.6 C
104 Arun 350 Medical 75.5 B
105 Sophy 600 Biology 90.3 A
-------------------------------------------------------------------------------------------------------------
1. To display the details of medical stream student from the student table.
2. To display stream and number of students in each stream of the given table student.
3. To display the name and grade whose avgmark is above 85.
4. To increase the stipend by 200 whose grade is A.

Answers:
1. select * from STUDENT where STREAM='Medical';
2. select STREAM, count(*) from STUDENT group by STREAM;
3. select NAME, GRADE from STUDENT where AVGMARK>85;
4. update student set stipend=stipend+200 where grade='A';

2. Write SQL commands for the questions given below using SALES table .
-----------------------------------------------------------------------------------------------------------------------
NAME PRODUCT P_CODE QTY_TAR PRICE COMMISSION
-----------------------------------------------------------------------------------------------------------------------
Santhosh Lux S002B 50 15.35 120
Praveen Harpic T098C 20 40.25 150
Kumar Britannia G045E 20 11.25 100
Arjun Glaxo G045E 30 67.85 150
Jacob Hamam S002B 40 11.50 200
-----------------------------------------------------------------------------------------------------------------------
1. To display all the records whose QTY_TAR is more than 35 in ascending order of product.
2. To display the name and product where the product is Britannia and the commission>=100.
3. To display the P_CODE, number of records for each P_CODE from the table sales.
4. To delete the record whose commission is 150.

Answers:
1. select * from SALES where QTY_TAR>35 order by PRODUCT;
2. select NAME, PRODUCT from SALES where PRODUCT =”Britannia” and COMMISSION>=100;
3. select P_CODE, count(*) from SALES group by P_CODE;
4. delete from sales where commission=150;
3. Write SQL commands for the questions given below using MOVIE table.
----------------------------------------------------------------------------------------------------------------
TITLE TYPE RATING STARS QTY PRICE
----------------------------------------------------------------------------------------------------------------
Liar Liar Comedy PG13 Jim Carre 5 25.35
Lost World Horror PG Melgibson 4 35.45
The specialist Action G Stallon 3 40.23
Down Periscope Comedy PG13 Stone 6 43.25
Conair Action G Nicholas 3 55.25
----------------------------------------------------------------------------------------------------------------
1. To display all the details arranged by ascending order of title.
2. To display all the stars whose name starts with ‘S’.
3. To display Rating and number of records for each Rating.
4. To change the value of quantity as 10 for the movie type ‘comedy’.

Answers:
1. select * from MOVIE order by TITLE;
2. select stars from MOVIE where STARS like 'S%';
3. select RATING, count(*) from MOVIE group by RATING;
4. update movie set qty=10 where type='comedy';

4. Write SQL commands for the questions given below using LIBRARY table.
-----------------------------------------------------------------------------------------------------------------------------------------
BID TITLE AUTHOR TYPE PUB QTY DATE_OF_ISSUE
-----------------------------------------------------------------------------------------------------------------------------------------
101 Data structure Lipchutz DS McGraw 4 2019-01-05
102 Advanced Pascal Schildt PROG BPB 5 2019-02-16
103 Mastering C++ Gurewich PROG PHI 3 2019-03-22
104 Mastering Window Cowart OS BPB 6 2019-01-28
105 Network Guide Freed NET Zpress 5 2019-02-20
----------------------------------------------------------------------------------------------------------------------------------------
1. To display the number of books published by BPB.
2. To display the details of the books whose issued date is after January 2019.
3. To display the pub and average quantity of each publisher.
4. To delete the record whose type is PROG.

Answers:
1. select count(*) from library where PUB =’BPB’;
2. select * from library where date_of_issue >’2019-01-31’;
3. select pub, avg(qty) from library group by pub;
4. delete from library where type='PROG';

You might also like