QUESTION 27
Which two statements are true regarding tables? (Choose two.)
A. A table name can be of any length.
B. A table can have any number of columns.
C. A column that has a DEFAULT value cannot store null values.
D. A table and a view can have the same name in the same schema.
E. A table and a synonym can have the same name in the same schema.
D选项错,一个schema里面不能有相同的table name。
F选项对,不同的schema在一个数据库里面可以有相同的表名
Which two statements are true regarding tables? (Choose two.)
A. A table name can be of any length.
B. A table can have any number of columns.
C. A column that has a DEFAULT value cannot store null values.
D. A table and a view can have the same name in the same schema.
E. A table and a synonym can have the same name in the same schema.
F. The same table name can be used in different schemas in the same database.
答案:EF
解析:
命名规则参看官方文档:
http://docs.oracle.com/cd/E11882_01/server.112/e41084/sql_elements008.htm#SQLRF51129
A选项错,表名只能是1-30个字符:
Names must be from 1 to 30 bytes long with these exceptions:
-
Names of databases are limited to 8 bytes.
-
Names of database links can be as long as 128 bytes.
C选项错,DEFAULT可以指定null为默认值。
SQL> create table test1 (
2 t1 varchar2(10) default null);
D选项错,一个schema里面不能有相同的table name。
E选项部分对,synonym 可以相同,但仅仅是public synonym。
SQL> create synonym test1 for test1;
create synonym test1 for test1
*
ERROR at line 1:
ORA-01471: cannot create a synonym with same name as object
SQL> create public synonym test1 for test1;
Synonym created.
F选项对,不同的schema在一个数据库里面可以有相同的表名