a. You have been asked to write a SQL statement that will delete ConsumerID 45678.
b. Save your SQL query as SQLQuery1D1 and execute the statement.
c. Create an SQL statement that will delete all records that are from the state of California or Texas.
d. Save your SQL query as SQLQuery1D2 and execute the statement.
e. Make a note of many records that were deleted.
f. Write 1 SQL query that will prove that no records exist for ConsumerID 45678 or the Consumer is from California or Texas.
g. Save your SQL query as SQLQuery1D3 and execute the statement.
h. Take a screen shot of your query results.
This solution consists of questions on SQL queries mainly DML statements and select statement.
SQL Queries Using Group Statements
• Write queries using the SQL GROUP statement to produce the requested reports as described below. In general, to make grouping meaningful, a function such as COUNT or SUM is used. In the below tasks, COUNT(*) is the desired function to include in your SELECT statement along with the requested fields.
6. Display total number of employees for each job title. Columns should include Job_Title and 'Total Employees'. (Hint: use the "AS clause" to rename a column in the result set.)
7. Display total number of employees for each salary. Columns should include Salary and 'Total Employees'.
8. Display total number of employees for each salary within each job title. Columns should include Job Title, Salary, and 'Total Employees'.
9. Display total number of employees for each salary grouped by exempt status. Columns should include Exempt, Salary, and 'Total Employees'.