SQL_query_assigment
SQL_query_assigment
Final assignment
Assignment description
In this assignment, we are going to work on a database of a Tech company. The database consists of
three tables:
Assignment requirements
Your task is to carefully read the database description, understand the meaning of all table columns and
how they relate to each other. There are steps that you will take:
KHTN-MS-DB-K30-K31-StudentID.docx
KHTN-MS-DB-K30-K31-20C12345.docx
Assignment deadline
Deadline for the submission is 23:59:59 26/07/2023.
Assignment questions
1. Write an SQL query to create a database with a name of your choice to store data of the Tech
company.
2. Write an SQL query to create the table EmployeeInformation. You have to decide attributes of
columns, primary key and foreign key if necessary.
3. Write an SQL query to create the table EmployeeSalary. You have to decide attributes of
columns, primary key and foreign key if necessary.
4. Write an SQL query to create the table Departments. You have to decide attributes of columns,
primary key and foreign key if necessary.
5. Write an SQL query to insert data records to the table EmployeeInformation as described above.
6. Write an SQL query to insert data records to the table EmployeeSalary as described above.
7. Write an SQL query to insert data records to the table Departments as described above.
8. Write an SQL query to list first names, last names, and phone numbers of employees from the
UK.
9. Write an SQL query to select all the employees who come from either US or AUS and have a
monthly salary at least (greater than or equal to) 10,000.
10. Write an SQL query to count the number of employees in each department.
11. Write an SQL query to calculate the annual employee cost (total base salary and bonus) of the
company.
12. Write an SQL query to select the top-5 employees having highest annual income and sort their
incomes in descending order.
13. Write an SQL query to select employees having the highest monthly income of each department.
14. Write an SQL query to show the total annual base salary of Software Engineering department.
15. Write an SQL query to select the employee having lowest annual income and his or her name
must contain the letter ‘n’.
16. Write an SQL query to show the monthly employee cost of all departments in descending order.
17. Write an SQL query to show the average monthly cost of employees of each country.
18. Write an SQL query to show employee counts, grouped by department and country.
19. Write an SQL query to display employee information of those who have the highest salary from
each country.
20. Write an SQL query to select all employees coming from countries whose names end with letter
‘s’ and sort their salary in ascending order.
Assignment answers
Paste your full-screen-capture answers here.
1. Write an SQL query to create a database with a name of your choice to store data of the Tech
company.
full-screen-capture 1.jpg
2. Write an SQL query to create the table EmployeeInformation. You have to decide attributes of
columns, primary key and foreign key if necessary.
full-screen-capture 2.jpg
3. Write an SQL query to create the table EmployeeSalary. You have to decide attributes of
columns, primary key and foreign key if necessary.
full-screen-capture 3.jpg
4. Write an SQL query to create the table Departments. You have to decide attributes of columns,
primary key and foreign key if necessary.
full-screen-capture 4.jpg
5. Write an SQL query to insert data records to the table EmployeeInformation as described above.
full-screen-capture 5.jpg
6. Write an SQL query to insert data records to the table EmployeeSalary as described above.
full-screen-capture 6.jpg
7. Write an SQL query to insert data records to the table Departments as described above.
full-screen-capture 7.jpg
8. Write an SQL query to list first names, last names, and phone numbers of employees from the
UK.
full-screen-capture 8.jpg
9. Write an SQL query to select all the employees who come from either US or AUS and have a
monthly salary at least (greater than or equal to) 10,000.
full-screen-capture 9.jpg
10. Write an SQL query to count the number of employees in each department.
full-screen-capture 10.jpg
11. Write an SQL query to calculate the annual employee cost (total base salary and bonus) of the
company.
full-screen-capture 11.jpg
12. Write an SQL query to select the top-5 employees having highest annual income and sort their
incomes in descending order.
full-screen-capture 12.jpg
13. Write an SQL query to select employees having the highest monthly income of each department.
full-screen-capture 13.jpg
14. Write an SQL query to show the total annual base salary of Software Engineering department.
full-screen-capture 14.jpg
15. Write an SQL query to select the employee having lowest annual income and his or her name
must contain the letter ‘n’.
full-screen-capture 15.jpg
16. Write an SQL query to show the monthly employee cost of all departments in descending order.
full-screen-capture 16.jpg
17. Write an SQL query to show the average monthly cost of employees of each country.
full-screen-capture 17.jpg
18. Write an SQL query to show employee counts, grouped by department and country.
full-screen-capture 18.jpg
19. Write an SQL query to display employee information of those who have the highest salary from
each country.
full-screen-capture 19.jpg
20. Write an SQL query to select all employees coming from countries whose names end with letter
‘s’ and sort their salary in ascending order.
full-screen-capture 20.jpg