Ch8 Advanced SQL Flashcards
Get some examples of relational set operators
UNION, UNION ALL, INTERSECT, and MINUS
What does UNION do?
Union combines rows from two or more queries without including duplicate rows.
Give an example of a union relational set operator
SELECT emp_fname, emp_lname FROM employee UNION SELECT emp_fname, emp_lname FROM employee_1
What does UNION ALL do?
UNION ALL produces a relation that retains duplicate rows. Union does not retain duplicate rows.
What is the difference between union and union all?
Union includes duplicate rows union all does not
What does the INTERSECT relational set operator do?
INTERSECT combines rows from two queries, returning only the rows that appear in both sets
Relational set operators are only useful when _______
There are two or more tables with an identical list of attributes.
What does the minus relational set operator do?
Minus returns only the rows that appear in the first set but not second
How many rows in a table?
SELECT COUNT (*) FROM table name
What is the difference between Group by and order by
Group by is for rows order by is for columns