Download as pdf or txt
Download as pdf or txt
You are on page 1of 22

MySQL Practical File

Q1) Create a table Employee2 as per the given description and


insert 7 records in it: -

Final Table: -

1|P ag e
Q2) Use the above table ‘Employee’ to answer the questions: -
a) To display all the details on screen.

b) To display name and salary of the employee.

c) To display name and date of joining of those employees who


work in Sales department.

2|P ag e
d) To display all the details of those employees whose name begin
with ‘A’ and ends with ‘N’.

e) To display all the details of those employees who work in


Purchase department and earns more than 50K per month.

f) To display name and annual salary of those employees who


work in accounts department.

g) To display the department without repeating duplicates.

h) To insert the given data in the table: (8, ’Pooja’, NULL, ’2021-09-
09’, 90000)

3|P ag e
i) To display name and salary of the employee in the given format:
Seema earns 80000
Pooja earns 90000

j) To display name of those employees who have not assigned any


department.

k) To display name and salary of all the employees in desc order by


date of joining.

4|P ag e
l) To increase the salary of all the employees by 10%.

m) To assign Sales department to ‘Pooja’.

n) To add one more column email_id in the table.

o) To store email ids in the column email_id.

p) To increase the size of name column by 5.

5|P ag e
q) To change the column name Sal_PM with salary.

Q3) Table Student: -

a) To display details of those students who have not provided


email_id.

6|P ag e
b) To display names of ‘Aravali’ house students in upper case.

c) To display names of those students who are born in ‘August’


month.

d) To display the name and email_id of those students who have a


account.

7|P ag e
e) To display no. of students of class 12D.

f) To display names of all the students in asc order.

g) To display average TM of 12C students.

8|P ag e
h) To display name and house of ‘Dhauladhar’ house students.

i) To display year of dob along with student name.

9|P ag e
j) To display first three letters of students name.

k) To display the position of ‘ten’ in all the name.

10 | P a g e
l) To display a sub-string ‘Ven’ from Manvendra.

m)To display total marks of all the ‘Shivalik’ house students after
rounding off the fraction part.

n) To display frequency of students in each house along with the


house name.

o) To display house name and total marks scored by each house’s


students. Display only whose details where total marks is more

11 | P a g e
than 1000.

p) To display names of those students who have minimum seven


letters in the name

Q4) Table SchoolBus, Inserting the data: -

Final Table: -

12 | P a g e
a) To show all information of students where capacity is more than
no. of student in order of rtno.

b) To show area_covered for buses more than 20KM, but charges


less than 80000.

c) To show the area covered by Bhalla Co. and kisan tours.

13 | P a g e
d) To show the names of all the transporters without repeating
their names.

e) To show all the bus routed number where the distance is less
than 30.

f) To show the area whose names end with ‘r’ in decreasing order
by area covered.

14 | P a g e
g) To show rtno, area_covered and average cost per student for all
routes where average cost per student is charges/noofstudent.

h) To show the area covered with bus routes number where


distance is more than 30.

15 | P a g e
i) To show the number of areas covered by each transporter.

j) To Show the maximum capacity of a bus

16 | P a g e
k) To show transporter wise total number of students traveling.

l) Add new record with data: (11,’Moti bagh’,35,32,10,’kisan


tours’,35000)

Q5) Table Employee & Department

a) Display the Salary, Zone, and Grade of all the employees.

17 | P a g e
b) Display the name of all the employees along with their annual
salaries. The Salary column should be given the name “Annual
Salary”.

c) Display the names of various zones from the table Employee. A


zone man should appear only once.

d) Display the details of all the employees who are getting a salary
of more than 35000 in department 30.

18 | P a g e
e) Display the details of all the employees whose salary is between
32000 and 38000.

f) Display the names of all the employees who are working in


department 20 or 30.

g) Display the name, salary, and age of all the employees whose
names start with ‘M’.

19 | P a g e
h) Display the details of all the employees whose names contain ‘a’
as the second character.

i) Display the highest and lowest salaries being paid in department


10.

j) Display the number of employees working in department 10.

20 | P a g e
k) Display the name and salary of all the employees in the
ascending order of those salaries.

l) Display the total number of employees in each department.

21 | P a g e
m) Put the grade B for all whose grade is NULL.

n) Display the Name and Department Name of all the employees.

o) Display the names of all the employees whose salary is out of


the specifies range for the corresponding department.

22 | P a g e

You might also like