ITPub博客

首页 > 数据库 > Oracle > OCP 1Z0-051-36

OCP 1Z0-051-36

原创 Oracle 作者:LuiseDalian 时间:2014-05-12 07:10:41 0 删除 编辑
(36)Examine the following SQL commands:

CREATE TABLE products

(

  prod_id      NUMBER(3) CONSTRAINT p_ck CHECK (prod_id > 0),

  prod_name CHAR(30),

  prod_qty    NUMBER(6),

  CONSTRAINT p_name NOT NULL,

  CONSTRAINT prod_pk PRIMARY KEY (prod_id)

);

CREATE TABLE warehouse

(

  warehouse_id NUMBER(4),

  roomno         NUMBER(10) CONSTRAINT r_id CHECK(roomno BETWEEN 101 AND 200),

  location         VARCHAR2(25),

  prod_id         NUMBER(3),

  CONSTRAINT wr_pr_pk PRIMARY KEY (warehouse_id,prod_id),

  CONSTRAINT prod_fk FOREIGN KEY (prod_id) REFERENCES products(prod_id)

);

Which statements is true regarding the execution of the above SQL statements?

A. Both commands execute successfully.

B. The first CREATE TABLE command generates an error because the NULL constraint is not valid.

C. The second CREATE TABLE command generates an error because the CHECK constraint is not valid.

D. The first CREATE TABLE  command generates an error because CHECK and  PRIMARY KEY constraints cannot be used for the same column.

E. The first CREATE TABLE command generates an error because the column PROD_ID cannot be used in the PRIMARY KEY and FOREIGN KEY constraints.

答案:(B)

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/17013648/viewspace-1158781/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: OCP 1Z0-051-37
下一篇: OCP 1Z0-051-38
请登录后发表评论 登录
全部评论

注册时间:2012-02-06

  • 博文量
    1986
  • 访问量
    6043364