Class XII Computer Science (083)
Practical Assignment -1
(DDL & DML SQL Commands)
Q-1 Write SQL Command for (a) to (q) and output of (r)
TABLE : GRADUATE
SNO NAME STIPEND SUBJECT AVERAGE DIVISION
1 KARAN 400 PHYSICS 68 1
2 DIWAKAR 450 COMP Sc 75 1
3 DIVYA 300 CHEMISTRY 62 2
4 REKHA 350 PHYSICS 63 1
5 ARJUN 500 MATHS 70 1
6 SABINA 400 CHEMISTRY 55 2
7 JOHN 250 PHYSICS 64 1
8 ROBERT 450 MATHS 58 2
9 RUBINA 500 COMP Sc 62 1
10 VIKAS 400 MATHS 57 2
a. Create Database StuName1 and Create Table Graduate in StuName1 database with
SNO as prime attribute.
b. Insert 10 records in Graduate table.
c. List the names of those students who have obtained first division .
d. Display a report, listing NAME, STIPEND, SUBJECT and amount of stipend received in
a year assuming that the STIPEND is paid every month.
e. To display students details who are studying Maths subject.
f. To insert a new 11th record in the GRADUATE table with following data
(11,”KAJOL”, 300, “Comp Sc”, 75, 1)
g. Add a new column GRADE of character type with default value ‘Pass’.
h. Display Name and division only in Graduate table.
i. To display students details sorted by NAME.
j. To display students details sorted by NAME in descending order.
k. To display student’s details whose average is between 50 to 60.
l. Display student RUBINA’s all details.
m. Delete student KAJOL’s details from table.
n. To display students details who are either PHYSICS or COMPUTER SC graduates.
o. Change student Arjun’s Stipend to Rs 700.
p. Display the details of all First Divisioners in Computer Science.
q. Add four new Graduate students details in Student table and display all records.
r. Give the output of following sql statement based on table GRADUATE:
(i) Select * from GRADUATE where SUBJECT=”PHYSICS”;
(ii) Select Name, Average from GRADUATE WHERE div=2;
(iii) Select from Name, , Average from GRADUATE where AVERAGE>=65;
(iv) Select distinct SUBJECT from GRADUATE;
(v) Select * from GRADUATE where SUBJECT=”MATHS” order by Average desc;
(vi) DESC GRADUATE;
(vii) Select * from GRADUATE;
Write Cardinality and Degree Relation GRADUATE as shown in the output(vii)