OCP-1Z0-051-2015-36题
2015-07-22 17:59
344 查看
Which CREATE TABLE statement is valid? 找出创建表的格式正确的语句
A.
CREATE TABLE ord_details
(ord_no NUMBER(2) PRIMARY KEY,
item_no NUMBER(3) PRIMARY KEY,
ord_date DATE NOT NULL);
B.
CREATE TABLE ord_details
(ord_no NUMBER(2) UNIQUE, NOT NULL,
item_no NUMBER(3),
ord_date DATE DEFAULT SYSDATE NOT NULL);
C.
CREATE TABLE ord_details
(ord_no NUMBER(2) ,
item_no NUMBER(3),
ord_date DATE DEFAULT NOT NULL,
CONSTRAINT ord_uq UNIQUE (ord_no),
CONSTRAINT ord_pk PRIMARY KEY (ord_no));
D.
CREATE TABLE ord_details
(ord_no NUMBER(2),
item_no NUMBER(3),
ord_date DATE DEFAULT SYSDATE NOT NULL,
CONSTRAINT ord_pk PRIMARY KEY (ord_no, item_no));
Answer: D
Explanation:
A PRIMARY KEY constraint creates a primary key for the table. Only one primary key can be created for each table.
一个表只有一个主键。A错。UNIQUE, NOT NULL之间不要逗号,列级约束不要逗号,B错
一个DEFAULT 后面没有指定默认值,C错
The PRIMARY KEY constraint is a column or a set of columns that uniquely identifies each row in a table.
This constraint enforces the uniqueness of the column or column combination and ensures that no column that is part of the primary key can contain a null value.
Note: Because uniqueness is part of the primary key constraint definition,
the Oracle server enforces the uniqueness by implicitly (隐含的唯一性)creating a unique index on the primary key column or columns.
A.
CREATE TABLE ord_details
(ord_no NUMBER(2) PRIMARY KEY,
item_no NUMBER(3) PRIMARY KEY,
ord_date DATE NOT NULL);
B.
CREATE TABLE ord_details
(ord_no NUMBER(2) UNIQUE, NOT NULL,
item_no NUMBER(3),
ord_date DATE DEFAULT SYSDATE NOT NULL);
C.
CREATE TABLE ord_details
(ord_no NUMBER(2) ,
item_no NUMBER(3),
ord_date DATE DEFAULT NOT NULL,
CONSTRAINT ord_uq UNIQUE (ord_no),
CONSTRAINT ord_pk PRIMARY KEY (ord_no));
D.
CREATE TABLE ord_details
(ord_no NUMBER(2),
item_no NUMBER(3),
ord_date DATE DEFAULT SYSDATE NOT NULL,
CONSTRAINT ord_pk PRIMARY KEY (ord_no, item_no));
Answer: D
Explanation:
A PRIMARY KEY constraint creates a primary key for the table. Only one primary key can be created for each table.
一个表只有一个主键。A错。UNIQUE, NOT NULL之间不要逗号,列级约束不要逗号,B错
一个DEFAULT 后面没有指定默认值,C错
The PRIMARY KEY constraint is a column or a set of columns that uniquely identifies each row in a table.
This constraint enforces the uniqueness of the column or column combination and ensures that no column that is part of the primary key can contain a null value.
Note: Because uniqueness is part of the primary key constraint definition,
the Oracle server enforces the uniqueness by implicitly (隐含的唯一性)creating a unique index on the primary key column or columns.
相关文章推荐
- MD5加密
- js(jquery)绑定点击事件
- xcode中Auto Layout的使用
- js检测元素value改变
- org.eclipse.e4.core.di.InjectionException:org.eclipse.swt.SWTException: Widget is disposed
- 判断PC和移动端 判断移动端系统
- Advanced Auto Layout
- HDU 1026 Ignatius and the Princess I
- Spring声明式事务管理之xml事务管理
- 页面跳转 重定向(工作中遇到的问题)
- CentOS系统下docker的安装配置及使用详解
- 个人学习Java的一些心得!
- spring交易声明的几个传播特性
- split实用用法
- Haproxy 为 mysql 做负载均衡
- c语言2进制 位运算 应用
- UIView中常见的方法总结
- Linux下安装软件的一般步骤
- configure: error: xml2-config not found. Please check your libxml2 installation
- 职责链模式