IM FINALS Flashcards
(100 cards)
Which set operator combines the results of two or more component queries into one result, returning all distinct rows selected by either query?
a) UNION ALL
b) INTERSECT
c) UNION
d) MINUS
UNION
Which set operator returns all rows selected by either query, including all duplicates?
a) UNION
b) UNION ALL
c) INTERSECT
d) MINUS
UNION ALL
If you want to find all distinct rows that are selected by both the first SELECT statement AND the second SELECT statement, which operator would you use?
a) UNION
b) UNION ALL
c) INTERSECT
d) MINUS
INTERSECT
Which set operator returns all distinct rows selected by the first SELECT statement but NOT selected by the second SELECT statement?
a) UNION
b) UNION ALL
c) INTERSECT
d) MINUS
MINUS
What is the default evaluation order if a SQL statement contains multiple set operators without parentheses?
a) From right to left (bottom to top)
b) Based on operator precedence (INTERSECT first)
c) From left to right (top to bottom)
d) The Oracle server prompts the user for the order
From left to right (top to bottom)
When using set operators, what must be identical for all SELECT statements in the compound query?
a) The column names
b) The number of columns and the data types of the columns
c) The tables being queried
d) The WHERE clause conditions
The number of columns and the data types of the columns
By default, how is the output of a query using the UNION operator sorted?
a) Ascending order of the last column of the SELECT clause
b) Descending order of the first column of the SELECT clause
c) Ascending order of the first column of the SELECT clause
d) The output is not sorted by default
Ascending order of the first column of the SELECT clause
Which of the following is TRUE for the UNION ALL operator compared to the UNION operator?
a) UNION ALL eliminates duplicate rows, and UNION does not.
b) UNION ALL does not eliminate duplicate rows, and the output is not sorted by default.
c) UNION ALL requires column names to be identical, while UNION does not.
d) UNION ALL has higher precedence than UNION.
UNION ALL does not eliminate duplicate rows, and the output is not sorted by default.
If the order of tables in an INTERSECT operation is reversed, how does it affect the result?
a) The result will be the inverse.
b) The result will not be altered.
c) It will result in an error.
d) The result will only contain rows from the new first table.
The result will not be altered.
Where can the ORDER BY clause appear in a SQL statement using set operators?
a) After each SELECT statement
b) Only at the very end of the entire statement
c) Only after the first SELECT statement
d) It cannot be used with set operators
Only at the very end of the entire statement
If column names differ in SELECT statements combined by a set operator, which column names appear in the result?
a) Column names from the last SELECT statement
b) Column names from the first SELECT statement
c) Concatenated column names from all SELECT statements
d) The user is prompted to specify alias names
Column names from the first SELECT statement
To match expressions in select lists when using set operators, if data types differ, what can be used?
a) The IGNORE_DATATYPE_MISMATCH hint
b) The Oracle server automatically converts them
c) Dummy columns and data type conversion functions (e.g., TO_NUMBER, TO_DATE)
d) Set operators cannot be used if data types don’t match exactly
Dummy columns and data type conversion functions (e.g., TO_NUMBER, TO_DATE)
Which of the following is NOT a Data Manipulation Language (DML) statement?
a) INSERT
b) UPDATE
c) DELETE
d) CREATE
CREATE
A collection of DML statements that form a logical unit of work is called a:
a) Schema
b) Transaction
c) Subquery
d) View
Transaction
When using the INSERT statement with the VALUES clause, how many rows are inserted at a time?
a) Only one row
b) Multiple rows, depending on the values provided
c) As many rows as exist in the target table
d) It depends on the table’s primary key
Only one row
If you use the INSERT statement without a column list, what is required for the values?
a) Values must be listed in alphabetical order of column names.
b) Values must be provided only for NOT NULL columns.
c) Values must be listed according to the default order of the columns in the table, and a value must be provided for each column.
d) The Oracle server will prompt for values for each column.
Values must be listed according to the default order of the columns in the table, and a value must be provided for each column.
How can you insert a null value into a column implicitly using the INSERT statement?
a) Specify the NULL keyword in the VALUES clause.
b) Omit the column from the column list in the INSERT clause.
c) Use an empty string (‘’) for numeric columns.
d) Null values cannot be inserted implicitly.
Omit the column from the column list in the INSERT clause.
Which function can be used in an INSERT statement to record the current date and time?
a) CURRENT_DATE
b) NOW()
c) SYSDATE
d) TODAY()
SYSDATE
To insert a date value in a format other than the default, or to include a specific time, which function should be used?
a) CONVERT_DATE
b) FORMAT_DATE
c) TO_DATE
d) SET_DATE_FORMAT
TO_DATE
How can you add rows to a table where the values are derived from existing tables, without using the VALUES clause?
a) Using the INSERT INTO … CLONE FROM … statement
b) Using the INSERT INTO … SELECT … statement (a subquery)
c) Using the COPY_ROWS procedure
d) This requires a PL/SQL block
Using the INSERT INTO … SELECT … statement (a subquery)
What happens if you omit the WHERE clause in an UPDATE statement?
a) The statement will fail with an error.
b) Only the first row of the table will be updated.
c) All rows in the table will be modified.
d) No rows will be updated.
All rows in the table will be modified.
What happens if you omit the WHERE clause in a DELETE statement?
a) The statement will fail with an error.
b) Only the last row of the table will be deleted.
c) All rows in the table will be deleted.
d) No rows will be deleted.
All rows in the table will be deleted.
Which statement removes all rows from a table, is a DDL statement, and cannot easily be undone?
a) DELETE FROM table_name;
b) REMOVE ALL ROWS FROM table_name;
c) TRUNCATE TABLE table_name;
d) DROP TABLE table_name;
TRUNCATE TABLE table_name;
Which of the following is TRUE about the TRUNCATE statement?
a) It fires delete triggers on the table.
b) It generates extensive rollback information.
c) It can be easily rolled back using the ROLLBACK statement.
d) It cannot be used if the table is the parent of an enabled referential integrity constraint.
It cannot be used if the table is the parent of an enabled referential integrity constraint.