Ch. 8/A4 Flashcards
________ is a relational set operator.
a. MINUS
b. ALL
c. EXISTS
d. PLUS
a. MINUS
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.
c. The number of attributes must be the same and their data types must be alike.
Which data type is considered compatible with VARCHAR(35)?
a. CHAR(15)
b. DATE
c. TINYINT
d. INT
a. CHAR(15)
Which data type is compatible with NUMBER?
a. DATE
b. VARCHAR(15)
c. SMALLINT
d. CHAR(10)
c. SMALLINT
The ________ statement combines rows from two or more queries without including duplicate rows.
a. UNION ALL
b. MINUS
c. UNION
d. INTERSECT
c. UNION
What is the syntax for the UNION statement?
a. UNION: query query
b. query UNION query
c. UNION(query, query)
d. query + query
b. query UNION query
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
c. 15
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
d. 17
A(n) ________ query can be used to produce a relation that retains duplicate rows.
a. INTERSECT
b. UNION
c. UNION ALL
d. MINUS
c. UNION ALL
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
d. INTERSECT
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. MINUS
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
d. IN
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
d. NOT IN
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. “old-style” join
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. inner
The statement SELECT * FROM T1, T2 produces a(n) ________ join.
a. natural
b. full
c. cross
d. equi-
c. cross
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. full outer
How many different types of outer joins exist?
a. 1
b. 2
c. 3
d. 4
c. 3
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
d. 200
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. natural