Ch8 Advanced SQL Flashcards

1
Q

Get some examples of relational set operators

A

UNION, UNION ALL, INTERSECT, and MINUS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does UNION do?

A

Union combines rows from two or more queries without including duplicate rows.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Give an example of a union relational set operator

A
SELECT emp_fname, emp_lname
FROM employee
UNION
SELECT emp_fname, emp_lname
FROM employee_1
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does UNION ALL do?

A

UNION ALL produces a relation that retains duplicate rows. Union does not retain duplicate rows.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the difference between union and union all?

A

Union includes duplicate rows union all does not

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does the INTERSECT relational set operator do?

A

INTERSECT combines rows from two queries, returning only the rows that appear in both sets

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Relational set operators are only useful when _______

A

There are two or more tables with an identical list of attributes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does the minus relational set operator do?

A

Minus returns only the rows that appear in the first set but not second

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How many rows in a table?

A

SELECT COUNT (*) FROM table name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the difference between Group by and order by

A

Group by is for rows order by is for columns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly