Database Test 1
Database Test 1
www.techpile.in
Database Test
Name: __mohd ahsan___UserID:_ 288_____Mob No. 8960210597____
Instructions:
No negative marking for wrong answers. Max Marks:25
Write Your Answer Under The Question. Date: 04/11/2023
Attempt Any 25 Question.
9. Select all employee list of IT, Finance and Sales department who is older than 40 year
Query: select * from[dbo].[Employee_Data] where (Department in ('it','finance','sales')) and
[age]>40
10. Select all employee list who is from IT department and lives in United state or China country
TECHPILE : COPY OF THIS MATERIAL IS STRICTLY PROHIBATED
+91 – 7007237006 / 8052978684
www.techpile.in
11. Select name and EEID of all employees who is Male and lives in United State
Query: select [Full Name],[EEID] from [dbo].[Employee_Data] where [Gender]='Male' and
/[Country]='United States';
12. Select all v list who is between 30 to 50 age and works in IT or Finance Department.
Query select * from[dbo].[Employee_Data] where (age between 30 and 50) and (Department in
('it','finance') )
13. Select list of all employees who is older than 50 years and earn less than 100000 annualy.
Query: select * from[dbo].[Employee_Data] where (age>50) and [Annual_Salary]<100000
17. Select list of all employees who earns maximum annual salary
Query: select [full name], max([annual_salary]) from [dbo].[Employee_Data] group by [Full
Name]
18. Select list of oldest employee who earns maximum annual salary
Query: select [full name], max([annual_salary]) from [dbo].[Employee_Data] where age>=60
group by [Full Name]
19. Select list of all countries and total number of employees in each countries
Query: select [Country],count(*) from [dbo].[Employee_Data] group by [Country]
20. Select list of all Department and total number of employees in every department
Query: select [Department],count(*) from [dbo].[Employee_Data] group by [Department]
21. Select list of all department list with maximum and minimum annual_salary of each
department
Query: select [Department],min([Annual_Salary]),max([Annual_Salary]) from [dbo].
[Employee_Data] group by [Department]
23. Select list of every job_tile where maximum given annual salary is greater than 100000
Query: select [job_title] from [dbo].[Employee_Data] where [Annual_Salary]<100000 group by
[job_title] ;
24. Select list of every country and total number of cities registered in each country in order of
country name
Query: select [Country],count(*) from [dbo].[Employee_Data] group by [Country] order by
[Country] asc