OCP-1Z0-051 第26题 oracle对象命名规则

来源:互联网 发布:淘宝转化率10%算正常吗 编辑:程序博客网 时间:2024/04/27 22:29
一、原题
Which is the valid CREATE TABLE statement?
A. CREATE TABLE emp9$# (emp_no NUMBER (4));
B. CREATE TABLE 9emp$# (emp_no NUMBER(4));
C. CREATE TABLE emp*123 (emp_no NUMBER(4));
D. CREATE TABLE emp9$# (emp_no NUMBER(4), date DATE);

答案:A
二、题目解析
B选项不正确,因为表名不加双引号只能以字母开头。
C选项不正确,因为表名不加双引表名中不能包含*号。
D选项不正确,因为date是keyword, 不能做为列名。
详见联机文档oracle对象命令规则:
         http://docs.oracle.com/cd/E11882_01/server.112/e41084/sql_elements008.htm#SQLRF00223

摘录如下:
        1) Nonquoted identifiers must begin with an alphabetic character from your database character set. Quoted identifiers can begin with any character.
        2) Nonquoted identifiers can contain only alphanumeric characters from your database character set and the underscore (_), dollar sign ($), and pound sign (#).

三、实验

SQL> create table "2e"(id int);

Table created.

SQL> create table 3f(id int);
create table 3f(id int)
             *
ERROR at line 1:
ORA-00903: invalid table name

SQL> create table "2*e"(id int);

Table created.

SQL> create table 2*e(id int);
create table 2*e(id int)
             *
ERROR at line 1:
ORA-00903: invalid table name

0 0
原创粉丝点击