logo

SQL statements for data manipulation and database testing on Employees database

Assignment 2 for the Data Modelling & SQL Language module, requiring a 1500-word individual report on Database Development, weighted at 40% of the total module marks. The report is due on 19/12/2018.

19 Pages1637 Words351 Views
   

Added on  2023-05-30

About This Document

This documentation provides SQL statements for data manipulation and database testing on Employees database. It also discusses the importance of database testing and provides examples of field size validation, not null values, primary key, and foreign key.

SQL statements for data manipulation and database testing on Employees database

Assignment 2 for the Data Modelling & SQL Language module, requiring a 1500-word individual report on Database Development, weighted at 40% of the total module marks. The report is due on 19/12/2018.

   Added on 2023-05-30

ShareRelated Documents
Documentation
Task 1: Data Manipulation:
1. Write an SQL statement to list all employees with their full names, hire date and title
Query:
Select CONCAT_WS(" ",first_name,last_name) as full_name, hire_date, title from employees
inner join titles on titles.emp_no=employees.emp_no;
Output:
Picture 1
SQL statements for data manipulation and database testing on Employees database_1
2. Write an SQL statement to show the salary of all employees and their department name.
Query:
select salaries.emp_no, salary, dept_name from (dept_emp inner join departments on
departments.dept_no=dept_emp.dept_no) inner join salaries on
salaries.emp_no=dept_emp.emp_no;
Output:
Picture 2
SQL statements for data manipulation and database testing on Employees database_2
3. Write an SQL statement to show the full names and genders of HR department staff.
Query:
Select CONCAT_WS(" ",first_name,last_name) as full_name, gender from (employees inner
join dept_emp on dept_emp.emp_no=employees.emp_no) inner join departments on
departments.dept_no=dept_emp.dept_no where dept_name like 'Human Resources'
Output:
Picture 3
SQL statements for data manipulation and database testing on Employees database_3
4. Write an SQL statement to show the all departments’ name and their departments’ managers.
Query:
Select dept_name, CONCAT_WS(" ",first_name,last_name) as full_name from
(employees inner join dept_manager on dept_manager.emp_no=employees.emp_no)
inner join departments on departments.dept_no=dept_manager.dept_no;
Output:
Picture 4
SQL statements for data manipulation and database testing on Employees database_4

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Data Modelling & SQL Language
|18
|2576
|416

SQL Statements for Employee Database | Desklib
|13
|1978
|98

Database Development Report
|15
|1025
|213

Data Modelling & SQL Language .
|14
|1451
|219

SQL Queries for Employee Database and Importance of Database Testing
|14
|1593
|119

Database Design and Implementation for Fashion Outlet
|33
|5708
|93