0% found this document useful (0 votes)
32 views3 pages

Database Test 1

Uploaded by

cevofiy647
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views3 pages

Database Test 1

Uploaded by

cevofiy647
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

+91 – 7007237006 / 8052978684

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.

1. select all employees list


Query : select*from [dbo].[Employee_Data]

2. Select EEID,name and Job_title of all student


Query: select eeid,[full name],[job_title] from [dbo].[Employee_Data]

3. Select all employee list who is 30 to 50 years old


Query: select*from [dbo].[Employee_Data] where age between 30 and 50

4. Select EEID,name,Department of all employees who is from United state


Query: select eeid,[full name],department from employee data where country=’united states’
5. select all employee list in ascending order of name
Query: select * from[dbo].[Employee_Data] order by [Full Name] asc

6. select all employess list in ascending order of department name


Query: select * from[dbo].[Employee_Data] order by [Department] asc

7. select all employees list who is older than 30 year


Query: select * from[dbo].[Employee_Data] where [age]>30

8. select all employee list of IT and Finance department


Query: select * from[dbo].[Employee_Data] where Department='it' or Department='Finance'

select * from[dbo].[Employee_Data] where Department in('it','Finance')

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

Query: select * from[dbo].[Employee_Data] where Department='it' and (Country in ('united


states', 'china'))

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

14. Select max and min annual salary of employees


Query: select max([Annual_Salary]),min([Annual_Salary]) from [dbo].[Employee_Data]

15. Select average annual salary of United state employee


Query: select avg([Annual_Salary]) from [dbo].[Employee_Data] where Country='United States'

16. Select min age of working employee who is from IT department


Query: select min([Age]) from [dbo].[Employee_Data] where [Department]='IT'

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]

TECHPILE : COPY OF THIS MATERIAL IS STRICTLY PROHIBATED


+91 – 7007237006 / 8052978684
www.techpile.in

22. Select maximum annual_salary given in every job_tile


Query: select [Department],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

=>select count(distinct city) as 'no of city',country from Employee_Data group by Country

25. Select list of all employees except IT and Sales department


Query: select*from [dbo].[Employee_Data] where [Department]<>'IT' or [Department]<>'Sales';

select*from [dbo].[Employee_Data] where [Department] not in(‘it’,’sales’)

26. Select list of every employee hired in 2019


Query: select*from [dbo].[Employee_Data] where [Hire_Date]>'2019-09-01T00:00:00.000'

TECHPILE : COPY OF THIS MATERIAL IS STRICTLY PROHIBATED

You might also like