You are on page 1of 15

INFORMATICS PRACTICES (065)

Practical File
Session : 2016 – 2017
MySQL queries and NetBeans

Submitted By : Submitted To :
Name – Shweta Mr. Rajeev Jaiswal
Class – Xi Science (P.G.T. Computer)
Roll No. - 38
ACKNOWLEDGEMENT
I owe my gratitude to Mr. Rajeev Jaiswal,
P.G.T. Computer of Doon valley Public
School for the help and guidence that he
offered for my practical work. I was
exceptionally fortunate to be with him as
his ideas have contributed much to this
practicle file report.
I am also thankful to “Mr. G.K
Shimal”,Principal, DOON VALLEY
PUBLIC SCHOOL, GARHI CANTT,
DEHRADUN who has provided a well
equiped lab with all the latest softwares and
other facilities to me. (SHWETA)
CERTIFICATE
This is to certify that “PRACTICAL FILE REPORT” of
“INFORMATICS PRACTICES (065)” being submitted
by Shweta of class XI Science for terminal/ annual
examination represent her own work carried out under
my supervision and guidance.
During the practical work her approach towards the
subject is sincere and logical.

Mr. Rajeev Jaiswal Mr. G.K. Shimal


(P.G.T. Computer ) (Principal)
Questions And Answers
Q.1(a) Write MySQL query to create the table student with the following
specification:

Feildname Datatype Consituent


No. Integar (4) primary key
Name Varchar (15)
Stipened Stipened (float) (6,2)
Stream Varchar (15)
Avg. Mark Float(4,2)
Grade Char (1)
Class Char (4)

Ans. Create table ‘student’


((No, integar <4>, primary key)
(Name, varchar <15>)
(Stipened, stipened <Float> <6,2>)
(stream, varchar<15>)
(Avg. Mark , float <4,2>)
(Grade, char <1>)
(class, char <4>));
Q.1(b) Write SQL command to insert the following records in the table
student :
S. NAME STIPENED STREAM AVG. GRADE CLASS
NO. MARK
1 Karan 400.00 Medical 78.5 B 12 B
2 Divakar 450.00 Commerce 89.2 A 11 C
3 Divya 300.00 Commerce 68.6 C 12 C

4 Arun 350.00 Humanities 73.1 B 12 C


5 Shabina 500.00 Non - 90.6 A 11 A
Medical
6 John 400.00 Medical 75.4 B 12 B
7 Robert 250.00 Humanities 64.4 C 11 A
8 Rubina 450.00 Non – 88.5 A 12 A
Medical
9 Vikas 500.00 Non – 92.0 A 12 A
Medical
10 Mohan 300.00 Commerce 67.5 C 12 C

Ans. Insert into student values (1, “Karan”, 400.00, “Medical”, 78.5, ‘B’,
’12 B’) ;
Q1.(c) Write SQL commands for the following on the basis of the given
table :
(i) To display the list of all non – medical students having average
marks more than 90 ?

S. NAME STIPENED STREAM AVG. GRADE CLASS


NO. MARK
1 Karan 400.00 Medical 78.5 B 12 B
2 Divakar 450.00 Commerce 89.2 A 11 C
3 Divya 300.00 Commerce 68.6 C 12 C

4 Arun 350.00 Humanities 73.1 B 12 C


5 Shabina 500.00 Non - 90.6 A 11 A
Medical
6 John 400.00 Medical 75.4 B 12 B
7 Robert 250.00 Humanities 64.4 C 11 A
8 Rubina 450.00 Non – 88.5 A 12 A
Medical
9 Vikas 500.00 Non – 92.0 A 12 A
Medical
10 Mohan 300.00 Commerce 67.5 C 12 C

Ans. MySQL > Select from student where stream = non – medical
and avg. Mark > 90:
(ii). To display a report listing in name , stipened , stream and
amount of stipened received in a year assuming that the stipened is
paid every month ?
S. NAME STIPENED STREAM AVG. GRADE CLASS
NO. MARK
1 Karan 400.00 Medical 78.5 B 12 B
2 Divakar 450.00 Commerce 89.2 A 11 C
3 Divya 300.00 Commerce 68.6 C 12 C

4 Arun 350.00 Humanities 73.1 B 12 C


5 Shabina 500.00 Non - 90.6 A 11 A
Medical
6 John 400.00 Medical 75.4 B 12 B
7 Robert 250.00 Humanities 64.4 C 11 A
8 Rubina 450.00 Non – 88.5 A 12 A
Medical
9 Vikas 500.00 Non – 92.0 A 12 A
Medical
10 Mohan 300.00 Commerce 67.5 C 12 C

Ans . MySQL > Select name , stipened , stream where stipened is


12<stipened> ;
(iii). To display the names of those students who are in class XII
sorted by the stipened ?

S. NAME STIPENED STREAM AVG. GRADE CLASS


NO. MARK
1 Karan 400.00 Medical 78.5 B 12 B
2 Divakar 450.00 Commerce 89.2 A 11 C
3 Divya 300.00 Commerce 68.6 C 12 C

4 Arun 350.00 Humanities 73.1 B 12 C


5 Shabina 500.00 Non - 90.6 A 11 A
Medical
6 John 400.00 Medical 75.4 B 12 B
7 Robert 250.00 Humanities 64.4 C 11 A
8 Rubina 450.00 Non – 88.5 A 12 A
Medical
9 Vikas 500.00 Non – 92.0 A 12 A
Medical
10 Mohan 300.00 Commerce 67.5 C 12 C

Ans . MySQL > Select no. ,name ,stipened from student where class=
12 order by stipened ;
(iv). To l ist all students sorted by avg. Mark in descending order?

S. NAME STIPENED STREAM AVG. GRADE CLASS


NO. MARK
1 Karan 400.00 Medical 78.5 B 12 B
2 Divakar 450.00 Commerce 89.2 A 11 C
3 Divya 300.00 Commerce 68.6 C 12 C

4 Arun 350.00 Humanities 73.1 B 12 C


5 Shabina 500.00 Non - 90.6 A 11 A
Medical
6 John 400.00 Medical 75.4 B 12 B
7 Robert 250.00 Humanities 64.4 C 11 A
8 Rubina 450.00 Non – 88.5 A 12 A
Medical
9 Vikas 500.00 Non – 92.0 A 12 A
Medical
10 Mohan 300.00 Commerce 67.5 C 12 C

Ans. MySQL > Select no. ,name ,stipened from student order by avg.
Mark desc ;
(v). To list all the student having avg. Mark more than 70 and less than
90 ?
S. NAME STIPENED STREAM AVG. GRADE CLASS
NO. MARK
1 Karan 400.00 Medical 78.5 B 12 B
2 Divakar 450.00 Commerce 89.2 A 11 C
3 Divya 300.00 Commerce 68.6 C 12 C

4 Arun 350.00 Humanities 73.1 B 12 C


5 Shabina 500.00 Non - 90.6 A 11 A
Medical
6 John 400.00 Medical 75.4 B 12 B
7 Robert 250.00 Humanities 64.4 C 11 A
8 Rubina 450.00 Non – 88.5 A 12 A
Medical
9 Vikas 500.00 Non – 92.0 A 12 A
Medical
10 Mohan 300.00 Commerce 67.5 C 12 C

Ans. MySQL > Select *from student where avg. Mark > 70 and <90 ;
(vi) To display the records of all the students whose name last letter is ‘n’ ?
S. NAME STIPENED STREAM AVG. GRADE CLASS
NO. MARK
1 Karan 400.00 Medical 78.5 B 12 B
2 Divakar 450.00 Commerce 89.2 A 11 C
3 Divya 300.00 Commerce 68.6 C 12 C

4 Arun 350.00 Humanities 73.1 B 12 C


5 Shabina 500.00 Non - 90.6 A 11 A
Medical
6 John 400.00 Medical 75.4 B 12 B
7 Robert 250.00 Humanities 64.4 C 11 A
8 Rubina 450.00 Non – 88.5 A 12 A
Medical
9 Vikas 500.00 Non – 92.0 A 12 A
Medical
10 Mohan 300.00 Commerce 67.5 C 12 C

Ans. MySQL >Select name from students where name like ‘% n’ :


(vii) To list number, name, stipened and stream of those students whose
grade is ‘B’and avg. Mark is more than 75 ?

S. NAME STIPENED STREAM AVG. GRADE CLASS


NO. MARK
1 Karan 400.00 Medical 78.5 B 12 B
2 Divakar 450.00 Commerce 89.2 A 11 C
3 Divya 300.00 Commerce 68.6 C 12 C

4 Arun 350.00 Humanities 73.1 B 12 C


5 Shabina 500.00 Non - 90.6 A 11 A
Medical
6 John 400.00 Medical 75.4 B 12 B
7 Robert 250.00 Humanities 64.4 C 11 A
8 Rubina 450.00 Non – 88.5 A 12 A
Medical
9 Vikas 500.00 Non – 92.0 A 12 A
Medical
10 Mohan 300.00 Commerce 67.5 C 12 C

Ans. MySQL >Select no. name, stipened, stream from students where
grade = ‘B’ and avg. mark > 75.
(viii) To list all the students of commerce stream having stipened more than
350 ?
S. NAME STIPENED STREAM AVG. GRADE CLASS
NO. MARK
1 Karan 400.00 Medical 78.5 B 12 B
2 Divakar 450.00 Commerce 89.2 A 11 C
3 Divya 300.00 Commerce 68.6 C 12 C

4 Arun 350.00 Humanities 73.1 B 12 C


5 Shabina 500.00 Non - 90.6 A 11 A
Medical
6 John 400.00 Medical 75.4 B 12 B
7 Robert 250.00 Humanities 64.4 C 11 A
8 Rubina 450.00 Non – 88.5 A 12 A
Medical
9 Vikas 500.00 Non – 92.0 A 12 A
Medical
10 Mohan 300.00 Commerce 67.5 C 12 C

Ans. MySQL >Select *from student where stream = commerce and


stipened > 300.
(ix) To display the list of all the students whose names second letter is ‘i’ ?
S. NAME STIPENED STREAM AVG. GRADE CLASS
NO. MARK
1 Karan 400.00 Medical 78.5 B 12 B
2 Divakar 450.00 Commerce 89.2 A 11 C
3 Divya 300.00 Commerce 68.6 C 12 C

4 Arun 350.00 Humanities 73.1 B 12 C


5 Shabina 500.00 Non - 90.6 A 11 A
Medical
6 John 400.00 Medical 75.4 B 12 B
7 Robert 250.00 Humanities 64.4 C 11 A
8 Rubina 450.00 Non – 88.5 A 12 A
Medical
9 Vikas 500.00 Non – 92.0 A 12 A
Medical
10 Mohan 300.00 Commerce 67.5 C 12 C

Ans. MySQL > select name from student where name like ‘_ i%’:
(x) To display the list of all students contaning ‘n’ as a letter in the table ?

S. NAME STIPENED STREAM AVG. GRADE CLASS


NO. MARK
1 Karan 400.00 Medical 78.5 B 12 B
2 Divakar 450.00 Commerce 89.2 A 11 C
3 Divya 300.00 Commerce 68.6 C 12 C

4 Arun 350.00 Humanities 73.1 B 12 C


5 Shabina 500.00 Non - 90.6 A 11 A
Medical
6 John 400.00 Medical 75.4 B 12 B
7 Robert 250.00 Humanities 64.4 C 11 A
8 Rubina 450.00 Non – 88.5 A 12 A
Medical
9 Vikas 500.00 Non – 92.0 A 12 A
Medical
10 Mohan 300.00 Commerce 67.5 C 12 C

Ans. MySQL > Select name from student where name like ‘%n%’:

You might also like