Final DBMS File.word-1
Final DBMS File.word-1
(DBMS) LAB
roll No : 2466003027
Semester: 2nd Code :- MCA-127P
Submitted by:
Submitted To:
Mission
VISION
MISSION
Sol :-
Employee_Table :
SQL Query :
From Employee
Where salary>12000;
Output :
name salary
Manoj Rana 15000
Khushi 12500
Gaurav Ghansela 13000
1
Ques 2. Create a query to display the employee name and department
number for employee_id 176. [Employee (Emp_id, name, salary,
SQL Query :
FROM EMPLOYEE
Output :
name Dep_no
Khushi D2
2
Ques 3. Display the name and salary for all employees whose salary
is not in the range of 5,000 and 12,000. [Employee (Emp_id, name,
salary, Address, Dep_no, Dep_name)].
Sol :-
Employee_Table :
SQL Query :
FROM EMPLOYEE
Output :
name salary
Manoj Rana 15000
Khushi 12500
Priyanshu Tyagi 4000
3
Ques 4. List the name and salary of employees who earn between
5,000 and 12,000, and are in department20. [(EMPLOYEE
(Emp_id, name, salary, Address, Dep_no, Dep_name)].
Sol :-
Employee_Table :
SQL Query :
FROM EMPLOYEE
Output :
name salary
Tarushi Garg 10000
Gaurav Ghansela 11000
4
Ques 5. Display the names of all employees where the second letter of
the name is an "a". [EMPLOYEE (Emp_id, name, salary,
Address, Dep_no, Dep_name)].
Sol :-
Employee_Table :
SQL Query :
SELECT name
FROM EMPLOYEE
Output :
name
Manoj Rana
Tarushi Garg
Gaurav Ghansela
5
Ques 6. Display the names of all employees whose name starts with “a”.
[EMPLOYEE (Emp_id, name, salary, Address, Dep_no, Dep_name)].
Sol :-
Employee_Table :
SQL Query :
SELECT name
FROM EMPLOYEE
Output :
name
aditi Garg
6
Ques 7. Select ID, Name and Salary fields from the CUSTOMERS table
where salary is greater than 2000. [Customer (ID, name, Salary)].
Sol :-
Customer_Table :
SQL Query :
FROM customer
Output :
ID name Salary
1 Manoj Rana 3200
4 Priyanshu Tyagi 2200
5 Gaurav Ghansela 2500
7
Ques 8. Select ID, Name and Salary fields from the CUSTOMERS table for
a customer with name Hardik. [Customer (ID, name, Salary)].
Sol :-
Customer_Table :
SQL Query :
FROM CUSTOMER
Output :
ID name Salary
1 Hardik 3200
8
Ques 9. Select Name and Salary fields of the customers available in CUSTOMERS
table. [Customer (ID, name, Salary)].
Sol :-
Customer_Table :
SQL Query :
FROM Customers;
Output :
name salary
Manoj Rana 3200
Khushi 1800
Tarushi Garg 2000
Priyanshu Tyagi 2200
Gaurav Ghansela 2500
9
Ques 10. Select Name and Salary fields of the customers available in CUSTOMERS
table where salary contains null value. [Customer (ID, name, Salary)].
Sol :-
Customer_Table :
SQL Query :
FROM CUSTOMER
Output :
name salary
Manoj Rana NULL
Tarushi Garg NULL
10
Ques 11. Select ID, Name and Salary fields from the CUSTOMERS table
where salary is greater than 2000 OR age is less than 25 years.
Sol :-
Customer_Table :
SQL Query :
FROM CUSTOMER
Output :
ID name Salary
1 Manoj Rana 3200
2 Khushi 1800
11
Ques 12. Find all records from Employee table whose employee name starts with
A and ends with T. [EMPLOYEE (Emp_id, Name, salary, Address, Dep_no,
Dep_name)].
Sol :-
Employee_Table :
SQL Query :
Output :
12
Ques 13. Find number of employees from Employee table. [EMPLOYEE (Emp_id,
SQL Query :
FROM EMPLOYEE;
Output :
Total_Employees
5
13
Ques 14. Select the name from Employee table and show them in ascending
order. (EMPLOYEE (Emp_id, name, salary, Address, Dep_no,
Dep_name)].
Sol :-
Employee_Table :
SQL Query :
SELECT name
FROM EMPLOYEE
Output :
name
Gaurav Ghansela
Khushi
Manoj Rana
Priyanshu Tyagi
Tarushi Garg
14
Ques 15. Find Average salary of Employees. [EMPLOYEE (Emp_id, name, salary,
SQL Query :
SELECT AVG(salary) AS average_salary
FROM EMPLOYEE;
Output :
Average_salary
10500
15
Ques 16. Find maximum salary from Employee table. [EMPLOYEE (Emp_id,
SQL Query :
FROM Employee;
Output :
Maximum_salary
15000
16
Ques 17. Find Maximum and minimum salary from Employee table.
SQL Query :
Output :
Maximum_salary Minimum_salary
15000 4000
17
Ques 18. Find the number of employees in each department (use Groupby
Function). [EMPLOYEE (Emp_id, name, salary, Dep_name)].
Sol :-
Employee_Table :
SQL Query :
FROM EMPLOYEE
GROUP BY Dep_name;
Output :
Dep_name Total_employee
Sales 2
Accountant 2
purchase 1
18
Ques 19. Display employee name, id, Dep_name and salary of all
employees whose name begin with 'T' and salary greater than
SQL Query :
FROM EMPLOYEE
Output :
19
Ques 20. Find name and salary from employee table show the Employees
Dep_name)].
Sol :-
Employee_Table :
SQL Query :
SELECT name, salary
FROM EMPLOYEE
Output-
name salary
Khushi 15000
Tarun 13000
Tom 12500
Tanu 11000
Manoj Rana 8000
20