This query is used to fetch the full names of an employee, the date that the employee was hired, and the title of the employee. Because the full names are saved as first name and last name the query uses an inbuilt sql function called concat which concatenates the two columns while adding a space between the two columns. To get the title a join between employees table and titles table is needed. The type of join used is inner join using the emp_no column in both tables thus the query returns all columns for which the emp_no in the employees table matches the emp_no in the titles table.
This query is used to show the full names of each employee, their current salary and the department name the employee works in. Concat function is used to show the full names of the employee by concatenating the first name and the last name of the employee. The salary of an employee is found in the salaries table thus an inner join is done between the salaries table and the employee table using the emp_no column in both tables. To get the department name that an employee works in, a join between employees table and departments table is done using the joint table dept_emp.
This query is used to show the full names and the gender of all employees working in the human resources department. The first name and the last name are concatenated using the concat function. To join the employees and departments tables a join of the dept_emp supporting table is done. Finally a condition is used to filter only employees working in the human resources department.
Results:
This query is used to show the names of all departments and the names of the manager for each respective department. To get the full names of the manager, concatenation of the first and last name of the manager is done using the concat function. An inner join between the departments table and dept_manager table is done and another inner join between the dept_manager and employees table is done. The dept_manager is the joint table joining departments and employees table.
This query Is used to get the department name, the name of the manager, the date that the manager was hired for all managers that were hired after 1986 which is from 1st of January 1987. To get the full names of the manager, concatenation of the first and last name of the manager is done using the concat function. An inner join between the departments table and dept_manager table is done and another inner join between the dept_manager and employees table is done. The dept_manager is the joint table joining departments and employees table.A condition is used to filter all managers who were hired after 1986.
This query is used to update the date of birth of an employee using their last name. The first query shows the details of the employees before the update is done. The second query updates only the date of birth of the employee with the last name as Simmels that is why according to the screenshot, only 1 row has been affected. The last query shows the details of the employee after the update query is done.
SQL Code:
This query is used to delete an employee with employee id 10003 who is working in department d004. The employee
SQL Code:
Fetching the results of the query.
This view is created to get the full names of employees, their salaries and the full names of the department that the employee works in.
SQL Code:
Select all the rows in the view
SQL Code:
Before Update:
Update Query
This query is used to update the salaries of all employees working in the marketing department. To update the salary you have to join the employees table to the supporting dept_emp table and then join it to the departments table and finally join it to the salaries table and restrict the update for only those employees working in the department with the department name marketing.
Database testing is important because complex applications require complex backend databases to support the application. Thus there is a need to test the database to make sure it meets the all requirements required for the efficient and accurate operation of the front end part of the application. Testing in databases is done for;
Field size validation involves testing the database to make sure that the size of the field specified for a specific column is not violated. For example if a column has varchar data type and is restricted to a size of 50 then no data should have data exceeding 50 for this column.
To test field size validation we insert data in departments table where the dept_no should have is char(4) so we insert a record with more than 4 characters.
The query executes successfully but the value inserted in the table is trimmed to 4 characters as shown in the results below.
Not null validation ensures that a column that has a property of null must all always have a value during the insertion of a record. For example in the departments table the dept_name has not property thus inserting a null value would fail.
Query
When this query is executed it fails because dept_name should not have a null value.
Primary key validation involves making sure no duplicate primary keys exist in a table because every primary key is supposed to be unique. For example in the departments table, inserting a duplicate entry key results to an error as shown in below.
Foreign key validation involves testing that no integrity constraints are violated. For example you cannot insert a record in the child table for a primary key that does not exist in the parent table. For example considering two tables; employees the parent table and salaries the child table, you cannot insert a salary record for an employee that does not exist as demonstrated in the screenshot below.
References
Sharma, R., Mohamed, A., Aryan, M., kuchana, r., Ramesh, M. and patra, s. (2018). Database Testing Guide (Why, How, and What About Database Testing). [online] Softwaretestinghelp.com. Available at: https://www.softwaretestinghelp.com/database-testing-process/ [Accessed 20 Nov. 2018].
Essay Writing Service Features
Our Experience
No matter how complex your assignment is, we can find the right professional for your specific task. Contact Essay is an essay writing company that hires only the smartest minds to help you with your projects. Our expertise allows us to provide students with high-quality academic writing, editing & proofreading services.Free Features
Free revision policy
$10Free bibliography & reference
$8Free title page
$8Free formatting
$8How Our Essay Writing Service Works
First, you will need to complete an order form. It's not difficult but, in case there is anything you find not to be clear, you may always call us so that we can guide you through it. On the order form, you will need to include some basic information concerning your order: subject, topic, number of pages, etc. We also encourage our clients to upload any relevant information or sources that will help.
Complete the order formOnce we have all the information and instructions that we need, we select the most suitable writer for your assignment. While everything seems to be clear, the writer, who has complete knowledge of the subject, may need clarification from you. It is at that point that you would receive a call or email from us.
Writer’s assignmentAs soon as the writer has finished, it will be delivered both to the website and to your email address so that you will not miss it. If your deadline is close at hand, we will place a call to you to make sure that you receive the paper on time.
Completing the order and download