March 2000
Beginner
464 pages
9h 17m
English
The single query is one SELECT statement, while the compound query includes two or more SELECT statements.
Compound queries are formed by using some type of operator that is used to join the two queries. The UNION operator in the following examples is used to join two queries.
A single SQL statement could be written as follows:
SELECT EMP_ID, SALARY, PAY_RATE FROM EMPLOYEE_PAY_TBL WHERE SALARY IS NOT NULL OR PAY_RATE IS NOT NULL;
This is the same statement using the UNION operator:
SELECT EMP_ID, SALARY FROM EMPLOYEE_PAY_TBL WHERE SALARY IS NOT NULL UNION SELECT EMP_ID, PAY_RATE FROM EMPLOYEE_PAY_TBL WHERE PAY_RATE IS NOT NULL;
The previous statements return pay information for all employees who are ...
Read now
Unlock full access