Ch. 8/A4 Flashcards

1
Q

________ is a relational set operator.

a. MINUS
b. ALL
c. EXISTS
d. PLUS

A

a. MINUS

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

What is meant by “union-compatible”?

a. The number of attributes must be the same but the names and data types can be different.
b. The names of the relation attributes must be the same but the data types can be different.
c. The number of attributes must be the same and their data types must be alike.
d. The names of the relation attributes can be different, as well as the number of attributes, but data types must be similar.

A

c. The number of attributes must be the same and their data types must be alike.

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

Which data type is considered compatible with VARCHAR(35)?

a. CHAR(15)
b. DATE
c. TINYINT
d. INT

A

a. CHAR(15)

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

Which data type is compatible with NUMBER?

a. DATE
b. VARCHAR(15)
c. SMALLINT
d. CHAR(10)

A

c. SMALLINT

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

The ________ statement combines rows from two or more queries without including duplicate rows.

a. UNION ALL
b. MINUS
c. UNION
d. INTERSECT

A

c. UNION

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

What is the syntax for the UNION statement?

a. UNION: query query
b. query UNION query
c. UNION(query, query)
d. query + query

A

b. query UNION query

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

Assume you are using the UNION statement to combine the results from two identical tables CUSTOMER and CUSTOMER_2. The CUSTOMER table contains 10 rows, while the CUSTOMER_2 table contains seven rows. There are two customers included in both tables. How many records are returned when using the UNION statement?

a. 7
b. 10
c. 15
d. 17

A

c. 15

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

Assume you are using the UNION ALL statement to combine the results from two identical tables CUSTOMER and CUSTOMER_2. The CUSTOMER table contains 10 rows, while the CUSTOMER_2 table contains seven rows. There are two customers included in both tables. How many records are returned when using the UNION ALL statement?

a. 7
b. 10
c. 15
d. 17

A

d. 17

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

A(n) ________ query can be used to produce a relation that retains duplicate rows.

a. INTERSECT
b. UNION
c. UNION ALL
d. MINUS

A

c. UNION ALL

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

The ________ statement can be used to combine rows from two queries, returning only the rows that appear in both sets.

a. UNION
b. MINUS
c. UNION ALL
d. INTERSECT

A

d. INTERSECT

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

The ________ statement in SQL combines rows from two queries and returns only the rows that appear in the first set but not in the second.

a. MINUS
b. UNION ALL
c. INTERSECT
d. UNION

A

a. MINUS

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

What type of subquery could be used in place of INTERSECT if the RDBMS does not support it?

a. AND
b. UNION
c. OF
d. IN

A

d. IN

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

What type of subquery could be used in place of MINUS if the RDBMS does not support it?

a. UNION
b. AND
c. IN
d. NOT IN

A

d. NOT IN

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

The following SQL statement uses a(n) ________.

SELECT P_CODE, P_DESCRIPT, P_PRICE, V_NAME
FROM PRODUCT, VENDOR
WHERE PRODUCT.V_CODE = VENDOR.V_CODE;

a. “old-style” join
b. procedural statement
c. set operator
d. natural join

A

a. “old-style” join

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

The ________ join is the traditional join in which only rows that meet a given criteria are selected.

a. inner
b. set
c. full
d. outer

A

a. inner

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

The statement SELECT * FROM T1, T2 produces a(n) ________ join.

a. natural
b. full
c. cross
d. equi-

A

c. cross

17
Q

A ________ join of two tables returns rows with matching values and includes all rows from both tables with unmatched values.

a. full outer
b. natural
c. cross
d. left outer

A

a. full outer

18
Q

How many different types of outer joins exist?

a. 1
b. 2
c. 3
d. 4

A

c. 3

19
Q

How many rows would be returned from a cross join of tables A and B if A contains 10 rows and B contains 20?

a. 10
b. 20
c. 30
d. 200

A

d. 200

20
Q

A(n) ________ join will select only the rows with common values in the common column(s), excluding rows with unmatched values and duplicate columns.

a. natural
b. cross
c. outer
d. full

A

a. natural