Description
I've attached a word file that has 10 SQL questions that need to be answered.
Problem 7.1
Write the SQL code required to list the employee number, last name, first name, and middle initial of all employees whose last names start with Smith. In other words, the rows for both Smith and Smithfield should be included in the listing. Sort the results by employee number. Assume case sensitivity.
Problem 7.2
Using the EMPLOYEE, JOB, and PROJECT tables in the Ch07_ConstructCodatabase, write the SQL code that will join the JOB, EMPLOYEE, and PROJECTtables using common attributes. Display
Explanation & Answer
Attached.
Problem 7.1
Write the SQL code required to list the employee number, last name, first name, and middle
initial of all employees whose last names start with Smith. In other words, the rows for both
Smith and Smithfield should be included in the listing. Sort the results by employee number.
Assume case sensitivity.
SELECT emp_num, emp_lname, emp_fname, emp_initial
FROM employee
WHERE emp_lname Like ‘Smith%’
ORDER BY emp_num;
Problem 7.2
Using the EMPLOYEE, JOB, and PROJECT tables in the Ch07_ConstructCodatabase, write
the SQL code that will join the JOB, EMPLOYEE, and PROJECTtables using common
attributes. Display the attributes shown in the results presented in Figure P7.2, sorted by
project value.
SELECT Project.proj_name, Project.proj_value, Project.proj_balance
FROM Project
INNER JOIN Employee ON Project.proj_name=Employee.proj_name
INNER JOIN Job ON Employee.job_code=Job.job_code;
Problem 7.3
Write the SQL code that will produce the same information that was shown in Problem 2,
but sorted by the employee’s la...