76.
The STATE table has the following constraints (the constraint status is shown in parentheses):
Primary key pk_state (enabled) Foreign key COUNTRY table: fk_state (enabled) Check constraint ck_cnt_code (disabled) Check constraint ck_st_code (enabled) Not null constraint nn_st_name (enabled) You execute the following SQL: CREATE TABLE STATE_NEW AS SELECT * FROM STATE; How many constraints will there be in the new table?
- [A]0
- [B]1
- [C]3
- [D]5
- [E]2
- Answer & Explanation
- Report
Answer : [B]
Explanation :
Explanation :
When you create a table using CTAS (CREATE TABLE AS SELECT), only the NOT NULL constraints are copied. |
77.
Which line of code has an error?
1 CREATE TABLE FRUITS_VEGETABLES
2 (FRUIT_TYPE VARCHAR2,
3 FRUIT_NAME CHAR (20),
4 QUANTITY NUMBER);
1 CREATE TABLE FRUITS_VEGETABLES
2 (FRUIT_TYPE VARCHAR2,
3 FRUIT_NAME CHAR (20),
4 QUANTITY NUMBER);
- [A]1
- [B]2
- [C]3
- [D]4
- Answer & Explanation
- Report
Answer : [B]
Explanation :
Explanation :
A VARCHAR2 datatype should always specify the maximum length of the column. |
78.
Which statement successfully adds a new column, ORDER_DATE, to the table ORDERS?
- [A]ALTER TABLE ORDERS ADD COLUMN ORDER_DATE DATE;
- [B]ALTER TABLE ORDERS ADD ORDER_DATE (DATE);
- [C]ALTER TABLE ORDERS ADD ORDER_DATE DATE;
- [D]ALTER TABLE ORDERS NEW COLUMN ORDER_DATE TYPE DATE;
- Answer & Explanation
- Report
Answer : [C]
Explanation :
Explanation :
The correct statement is C. When adding only one column, the column definition doesn't need to be enclosed in parentheses. |
79.
What are the special characters allowed in a table name? (Choose all that apply.)
- [A]&
- [B]#
- [C]@
- [D]$
- Answer & Explanation
- Report
Answer : [B, D]
Explanation :
Explanation :
Only three special characters ($, _, and #) are allowed in table names along with letters and numbers. |
80.
Consider the following statement:
CREATE TABLE MY_TABLE ( 1ST_COLUMN NUMBER, 2ND_COLUMN VARCHAR2 (20));Which of the following best describes this statement?
- [A]Tables cannot be created without a defining a primary key. The table definition here is missing the primary key. >
- [B]The reserved word COLUMN cannot be part of the column name.
- [C]The column names are invalid.
- [D]There is no maximum length specified for the first column definition. You must always specify a length for character and numeric columns.
- [E]There is no error in the statement
- Answer & Explanation
- Report
Answer : [C]
Explanation :
Explanation :
All identifiers (column names, table names, and so on) must begin with an alphabetic character. An identifier can contain alphabetic characters, numbers, and the special characters $, #, and _. |