db2.9.1

1>Each of the following SQL queries has an error. Find the error and correct it. Use Oracle Application Express to verify that your corrections produce the desired results.

a.

SELECT manager_id

FROM employees

WHERE AVG(salary) <16000

GROUP BY manager_id;

b.

SELECT cd_number, COUNT(title)

FROM d_cds

WHERE cd_number < 93;

c.

SELECT ID, MAX(ID), artist

FROM d_songs

WHERE duration IN('3 min', '6 min', '10 min')

HAVING ID < 50

GROUP by ID

2>Indicate True or False

a. If you include a group function and any other individual columns in a SELECT clause, then each individual column must also appear in the GROUP BY clause.

b. You can use a column alias in the GROUP BY clause.

c. The GROUP BY clause always includes a group function.

3>Write a query that will return both the maximum and minimum average salary grouped by department from the employees table

4>Write a query that will return the average of the maximum salaries in each department for the employees table.

results for ""

    No results matching ""