Examine the structure of the sales table:
Evaluate the following create table statement:
Which two statements are true about the creation of the SALES1 table?
A.
The SALES1 table is created with no rows but only a structure.
B.
The SALES1 table would have primary key and unique constraints on the specified columns.
C.
The SALES1 table would not be created because of the invalid where clause.
D.
The SALES1 table would have not null and unique constraints on the specified columns.
E.
The SALES1 table would not be created because column-specified names in the select and
create table clauses do not match,
Explanation:
the question is about two true statement, but the answer is only one?!
The second answer is D
SQL> select * from test1;
P1 P2 P3
———- ———- ———-
1 2 3
1 3 4
2 rows selected.
SQL> create table test2 (p4, p5, p6) as select p1, p2,p3 from test1 where 1=2;
Table created.
SQL> select * from test2;
no rows selected
Answer A is correct!
ANSWER A AND D IS CORRECT!
SQL> desc emp
Nome Nulo? Tipo
———————– ——– —————-
EMPNO NOT NULL NUMBER(4)
ENAME VARCHAR2(10)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO NUMBER(2)
SQL> create table emp1 as select * from emp where 1=2;
Tabela criada.
Decorrido: 00:00:00.21
SQL> desc emp1;
Nome Nulo? Tipo
———————– ——– —————-
EMPNO NUMBER(4)
ENAME VARCHAR2(10)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO NUMBER(2)
correcting,
The two issues, A and D are correct.
The inequality filter in the WHERE is equivalent to creating the table structure only, with no record. The CREATE TABLE AS SELECT command creates the table without constraints of primary and foreign keys. Only NOT NULL and UNIQUE constraints are created with the CREATE TABLE AS SELECT.
correcting,
just NOT NULL is created with CREATE AS SELECT
Answer D should specify just NOT NULL, either is wrong also.
tHE CORRECT Answer is A and D , however the Unique constraint is not included in option D, only not null is being inherited using the systax.
You are right. A is correct. D is correct only for the NOT NULL excluding UNIQUE.
are these dumps still valid
Hi Everybody!
There is a correct answer : A
D is wrong because in this case Check and not null constraints will be copied but not unique, primary key or foreign key.
I am absolutely sure.
Have tested and confirm NOT NULL constraints will copy over, but unique, check, fk and PK will not.
So, either the question or answer is wrong in some way. So, the only correct answer would be A.