MySQL Lab Work
MySQL Lab Work
Work 2024-25
Name: Bhavya Rohila
Class: 12-C
Roll No: 27
Question 1)
create table graduate
( sno int(2) primary key,
name varchar(20) not null,
stipend int(3) not null,
subject varchar(20) not null,
average int(2) not null, divi
varchar(2) not null
);
values (10,'VIKAS',400,'MATHS',57,'II');
Answer(a)
Answer(b)
Answer(c)
e(i)
e(ii)
e(iii)
e(iv)
(g)
Question 2)
create table sports
(
studentno int(2) primary key,
class int(2) not null,
name varchar(15) not null,
game1 varchar(20) not null,
grade1 char(1)
check(grade1 in('A','B','C')),
game2 varchar(20) not null,
grade2 char (1)
check(grade2 in('A','B','C'))
);
insert into sports
values(10,7,'SAMMER','CRICKET','B','SWIMMING','A');
insert into sports
values(11,8,'SUJIT','TENNIS','A','SKATING','C');
insert into sports
values(12,7,'KAMAL','SWIMMING','B','FOOTBALL','B');
insert into sports
values(13,7,'VENNA','TENNIS','C','TENNIS','A');
insert into sports
values(14,9,'ARCHANA','BASKETBALL','A','CRICKET','A');
insert into sports
values(15,10,'ARPIT','CRICKET','A','ATHLETICS','C');
select * from sports;
(a)
(b)
(c)
(d)
(e)
(f )
(g)
Question 3)
create table employees
(
empid int(3) primary key,
firstname varchar(10) not null,
lastname varchar(10) not null,
address char(20) not null,
city varchar(20) not null
);
insert into employees
values(010, 'RAVI','KUMAR','RAJ NAGAR','GZB');
insert into employees
values(105, 'HARRY','WALTOR','GANDHI NAGAR','GZB');
insert into employees
values(152, 'SAM','TONES','33 ELM ST.','PARIS');
insert into employees
values(215, 'SARAH','ACKERMAN','440 U.S. 110','UPTON');
insert into employees
values(244, 'MANILA','SENGUPTA','24 FRIENDS STREET','NEW DELHI ');
insert into employees
values(300, 'ROBERT','SAMUEL','9 FIFTH CROSS','WASHINGTON');
insert into employees
values(335, 'RITU','TONDON','SHASTRI NAGAR','GZB');
insert into employees values(400, 'RACHEL','LEE','121 HARRISON ST.','NEW YORK');
insert into employees values(441, 'PETER','THOMPSON','11 RED ROAD','PARIS');
EmpSalary
(i) Select Firstname, Lastname, Address, City from Employees where city=”Paris”;
(ii) Select * from Employees order by Firstname desc;
(iii) Select Firstname, Lastname, salary+benefits ”Total Salary” from Employees, EmpSalary
where
Employee.Empid=EmpSalary.Empid;
(iv) Select max(salary) from EmpSalary where Designation=”Manager” and Designation=”Clerk”;
Question 4)
i)Select Book_name from Books where author_name=”P. Purohit” and Publishers=”FIRST PUBL.”;
Q5
(g)
(i)
(g)(ii)
Question 6)