100% found this document useful (1 vote)
203 views9 pages

SQL Practical File

Uploaded by

Pranjal Jain
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
100% found this document useful (1 vote)
203 views9 pages

SQL Practical File

Uploaded by

Pranjal Jain
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 9

No.

Practical Date Signature


1 Create Database Named Class11
2 Open Database Class 11
3 Create a student table with the student id, class, section, gender,
name, dob, and marks as attributes where the student id is the
primary key.
4 View the structure of the table
5 insert the details of at least 10 students in the above table.
6 Display the details of the student table.
7 Delete record of students who secured less than 65 marks.
8 Increase marks by 5% for who have studentid more than 1105.
9 Display the content of the table of female students.
10 Display studentid, Name and Marks whose marks are more than 50.
11 Find the average of marks from the student table.
12 Find the number of students, who are from section ‘A’.
13 Add a new column email in the above table.
14 Add the email ids of each student in the created email column.
15 Display the information of all the students, name contains ‘sh’
16 Display the information of all the students, name starts with ‘sh’
17 Display studentid, Name, DOB of who are born in 2005
18 Display studentid, Name, DOB, Marks, Email of male students in
ascending order of their names.
19 Display stduentid, Gender, Name, DOB, Marks, Email in
descending order of their marks.
20 display the unique section available in the table.
1. Create Database Named Class11
create database class11;

2. Open Database Class 11


use class11;

3. Create a student table with the student id, class, section, gender, name, dob,
and marks as attributes where the student id is the primary key.
create table student
(studentid int(4) primary key,
class char(2),
section char(1),
gender char(1),
name varchar(20),
dob date,
marks decimal(5,2));

CLASS XI IP PRACTICAL FILE | | Page 8


4. View the structure of the table
desc student; OR
describe student

5. insert the details of at least 10 students in the above table.


insert into student values
(1101,'XI','A','M','Aksh','2005/12/23',88.21),
(1102,'XI','B','F','Moksha','2005/03/24',77.90),
(1103,'XI','A','F','Archi','2006/04/21',76.20),
(1104,'XI','B','M','Bhavin','2005/09/15',68.23),
(1105,'XI','C','M','Kevin','2005/08/23',66.33),
(1106,'XI','C','F','Naadiya','2005/10/27',62.33),
(1107,'XI','D','M','Krish','2005/01/23',84.33),
(1108,'XI','D','M','Ayush','2005/04/23',55.33),
(1109,'XI','C','F','Shruti','2005/06/01',74.33),
(1110,'XI','D','F','Shivi','2005/10/19',72.30);

CLASS XI IP PRACTICAL FILE | | Page 9


6. Display the details of the student table.
select * from student;

CLASS XI IP PRACTICAL FILE | | Page 10


7. Delete record of students who secured less than 65 marks.
delete from student where marks <65;

8. Increase marks by 5% for who have studentid more than 1105.


update stduent set marks=makrs+(marks*0.05) where studentid>1105;

9. Display the content of the table of female students.


select * from student where gender = 'f';

CLASS XI IP PRACTICAL FILE | | Page 11


10. Display studentid, Name and Marks whose marks are more than 50.
select studentid,name,marks from student where marks>50;

11. Find the average of marks from the student table.


select avg(marks) from student;

12. Find the number of students, who are from section ‘A’.
alter table student add column email varchar(20);

13. Add a new column email in the above table.


alter table student add column email varchar(20);

CLASS XI IP PRACTICAL FILE | | Page12


14. Add the email ids of each student in the created email column.
update student set email='a@a.com';

15. Display the information of all the students, name contains ‘sh’
select * from student where name like 'sh%';

16. Display the information of all the students, name starts with ‘sh’
select * from stduent where name like 'sh%';

17. Display studentid, Name, DOB of who are born in 2005


select studentid, name, dob from student where dob between '2005-
01-01' and '2005-12-31';

CLASS XI IP PRACTICAL FILE | | Page 13


18. Display studentid, Name, DOB, Marks, Email of male students in ascending
order of their names.
select studentid, name, dob from student order by name;

19. Display stduentid, Gender, Name, DOB, Marks, Email in descending order of
their marks.
select studentid, gender, name, dob, marks, email from student
orderby marks desc;

20. Display the unique section available in the table.


select distinct section from student;

CLASS XI IP PRACTICAL FILE | | Page 14

You might also like