Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
50% found this document useful (2 votes)
246 views

MySQL Lab Manual Activities of Class 11 2024-25

Uploaded by

sumansharma7359
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
50% found this document useful (2 votes)
246 views

MySQL Lab Manual Activities of Class 11 2024-25

Uploaded by

sumansharma7359
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

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,
andmarks 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));
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);
6. Display the details of the student table.
select * from student;
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';
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);
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';
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 order
by marks desc;

20. Display the unique section available in the table.


select distinct section from student;

You might also like