SQL Questions
SQL Questions
1. Write queries to create an “Employee” Database and “Emp_details” table with the
following fields:
Emp_id | Name | Address | Age | DOB | Mobile
Create another table “Dept” with the following structure:
Empid | Dept_name | Salary | Dept_id
D. Display the details of all the employees in decreasing order of their age from table
“emp_details”.
E. Delete the records of those employees whose age is more than 60 from the table
“emp_details”.
F. Display the department name and count of employees in each department from the table
“Dept”.
G. Write SQL query to display the average salary of Employees.
H. Display the name and age of those employees whose age is more than 25 and surname is
“Kumar” from the table “emp_details”.
I. Calculate and show the average salary of departments -Finance and HR. from the table
“Dept”.
J. Write SQL query to display the total number of male Employees in the table.
L. Display the Name, Address and salaries of the employees who are staying in ‘Vaishali’.
M. Display the employee id, name and salary of all the employees whose department id is
either ‘D2’ or ‘D3’.