What is the meaning of underscore ( ‘_’ ) in the LIKE statement? 

Match for any single character.

 What do you accomplish by GROUP BY … HAVING clause?

GROUP BY partitions the selected rows on the distinct values of the column on which you group by.

HAVING selects GROUPs which match the criteria specified

 Consider the employee table with column PROJECT nullable. How can you get a list of employees who are not assigned to any project?

SELECT EMPNO FROM EMP WHERE PROJECT IS NULL;

What is the result of this query if no rows are selected:

SELECT SUM(SALARY)

FROM EMP

WHERE QUAL=‘MSC’;

NULL

 Why SELECT * is not preferred in embedded SQL programs?

For three reasons:

If the table structure is changed ( a field is added ), the program will have to be modified

Program might retrieve the columns which it might not use, leading on I/O over head.

The chance of an index only scan is lost.

Advertisements