itgle.com

为表TEST中ID列添加主键约束的语法是()A、ALTER  TABLE  TEST  CHANGE( ID  INT  PRIMARY  KEY)B、ALTER  TABLE  TEST  ADD( ID  INT  PRIMARY  KEY)C、ALTER  TABLE  TEST  MODIFY( ID  INT  PRIMARY  KEY)D、ALTER  TABLE  TEST  ADD  CONSTRAINT PK  PRIMARY KEY (ID)

题目

为表TEST中ID列添加主键约束的语法是()

  • A、ALTER  TABLE  TEST  CHANGE( ID  INT  PRIMARY  KEY)
  • B、ALTER  TABLE  TEST  ADD( ID  INT  PRIMARY  KEY)
  • C、ALTER  TABLE  TEST  MODIFY( ID  INT  PRIMARY  KEY)
  • D、ALTER  TABLE  TEST  ADD  CONSTRAINT PK  PRIMARY KEY (ID)

相似考题
更多“为表TEST中ID列添加主键约束的语法是()A、ALTER  TABLE  TEST  CHANGE( ID  INT  PRIMARY  KEY)B、ALTER  TABLE  TEST  ADD( ID  INT  PRIMARY  KEY)C、ALTER  TABLE  TEST  MODIFY( ID  INT  PRIMARY  KEY)D、ALTER  TABLE  TEST  ADD  CONSTRAINT PK  PRIMARY KEY (ID)”相关问题
  • 第1题:

    Examine the data in the EMPLOYEES table.On the EMPLOYEES table, EMPLOYEE_ID is the primary key. MGR_ID is the ID of managers and refers to the EMPLOYEE_ID. The JOB_ID column is a NOT NULL column.Evaluate this DELETE statement:Why does the DELETE statement fail when you execute it?()

    A. There is no row with dept_id 90 in the EMPLOYEES table.

    B. You cannot delete the JOB_ID column because it is a NOT NULL column.

    C. You cannot specify column names in the DELETE clause of the DELETE statement.

    D. You cannot delete the EMPLOYEE_ID column because it is the primary key of the table.


    参考答案:C

  • 第2题:

    您在公司的数据库中成功创建了名为SALARY的表。您现在要通过向引用EMPLOYEES表的匹配列的SALARY表添加FOREIGNKEY约束条件来建立EMPLOYEES表与SALARY表之间的父/子关系。尚未向SALARY表添加任何数据。应执行以下哪条语句()

    • A、ALTER TABLE salary ADD CONSTRAINT fk_employee_id_01 FOREIGN KEY(employee_id)REFERENCES employees(employee_id)
    • B、ALTER TABLE salary ADD CONSTRAINT fk_employee_id_ FOREIGN KEY BETWEEN salary(employee_id)AND employees(employee_id)
    • C、ALTER TABLE salary FOREIGN KEY CONSTRAINT fk_employee_id_REFERENCES employees(employee_id)
    • D、ALTER TABLE salary ADD CONSTRAINT fk_employee_id_FOREIGN KEY salary(employee_id)=employees(employee_id)

    正确答案:A

  • 第3题:

    You executed the following code:   SQL> CREATE TABLE COUNTRY   (COUNTRY_ID CHAR(2) CONSTRAINT COUNTRY_ID_nn NOT NULL,   COUNTRY_NAME VARCHAR2(20),   CURRENCY_NAME VARCHAR2(20),   CONSTRAINT COUNTRY_ID_PK PRIMARY KEY (COUNTRY_ID))   ORGANIZATION INDEX;   In which tablespace will the mapping table be created?()

    • A、 SYSTEM tablespace
    • B、 SYSAUX tablespace
    • C、 Undo tablespace
    • D、 The tablespace of the Index Organized Table (IOT)

    正确答案:D

  • 第4题:

    您的主管让您修改ORDERS表中的AMOUNT列。他要求将该列配置为接受默认值250。该表包含您需要保留的数据。应执行以下哪条语句来完成此任务()

    • A、ALTER TABLE orders CHANGE DATATYPE amount TO DEFAULT 250
    • B、ALTER TABLE orders MODIFY(amount DEFAULT 250)
    • C、DROP TABLE orders CREATE TABLE orders(orderno varchar2(5)CONSTRAINT pk_orders_01 PRIMARY KEY,customerid varchar2(5)REFERENCES customers(customerid),orderdate date,amount DEFAULT 250)
    • D、DELETE TABLE orders CREATE TABLE orders(orderno varchar2(5)CONSTRAINT pk_orders_01 PRIMARY KEY,customerid varchar2(5)REFERENCES customers(customerid),orderdate date,amount DEFAULT 250)

    正确答案:B

  • 第5题:

    DEPARTMENT 表包含以下列: DEPT_ID NUMBER, Primary Key DEPT_ABBR VARCHAR2(4) DEPT_NAME VARCHAR2(30) MGR_ID NUMBER EMPLOYEE 表包含以下列: EMPLOYEE_ID NUMBER EMP_LNAME VARCHAR2(25) EMP_FNAME VARCHAR2(25) DEPT_ID NUMBER JOB_ID NUMBER MGR_ID NUMBER SALARY NUMBER(9,2) HIRE_DATE DATE 请评估以下语句: ALTER TABLE employee ADD CONSTRAINT REFERENTIAL (mgr_id) TO department(mgr_id); 是以下哪个说法()

    • A、ALTER TABLE语句创建从EMPLOYEE表到DEPARTMENT表的引用约束条件
    • B、ALTER TABLE语句创建从DEPARTMENT表到EMPLOYEE表的引用约束条件
    • C、ADD CONSTRAINT子句存在语法错误,因此ALTER TABLE语句将会失败
    • D、ALTER TABLE语句执行成功,但不重新创建引用约束条件

    正确答案:A

  • 第6题:

    You need to modify the STUDENTS table to add a primary key on the STUDENT_ID column. The table is currently empty.Which statement accomplishes this task?()

    • A、ALTER TABLE students ADD PRIMARY KEY student_id;
    • B、ALTER TABLE students ADD CONSTRAINT PRIMARY KEY (student _ id);
    • C、ALTER TABLE students ADD CONSTRAINT stud _ id _pk PRIMARY KEY (student _ id);
    • D、ALTER TABLE students MODIFY CONSTRAINT stud _ id _pk PRIMARY KEY (student _ id);

    正确答案:C

  • 第7题:

    Which statement explicitly names a constraint?()

    • A、ALTER TABLE student_grades   ADD   FOREIGN KEY (student_id) REFERENCES students(student_id);
    • B、ALTER TABLE student_grades   ADD CONSTRAINT NAME = student_id_fk   FOREIGN KEY (student_id) REFERENCES students(student_id);
    • C、ALTER TABLE student_grades   ADD CONSTRAINT student_id_fk   FOREIGN KEY (student_id) REFERENCES students(student_id);
    • D、ALTER TABLE student grades   ADD NAMED CONSTRAINT student_id_fk   FOREIGN KEY (student_id) REFERENCES students(student_id);
    • E、ALTER TABLE student grades   ADD NAME student_id_fk   FOREIGN KEY (student_id) REFERENCES students(student_id);

    正确答案:C

  • 第8题:

    单选题
    评估此CREATE TABLE语句的执行结果: CREATE TABLE part( part_id NUMBER, part_name VARCHAR2(25), manufacturer_id NUMBER(9), retail_price NUMBER(7,2) NOT NULL, CONSTRAINT part_id_pk PRIMARY KEY(part_id), CONSTRAINT cost_nn NOT NULL(cost), CONSTRAINT FOREIGN KEY (manufacturer_id) REFERENCES manufacturer(id)); 哪一行会导致产生错误()
    A

    6

    B

    7

    C

    8

    D

    9


    正确答案: A
    解析: 暂无解析

  • 第9题:

    单选题
    Which statement explicitly names a constraint?()
    A

    ALTER TABLE student_grades   ADD   FOREIGN KEY (student_id) REFERENCES students(student_id);

    B

    ALTER TABLE student_grades   ADD CONSTRAINT NAME = student_id_fk   FOREIGN KEY (student_id) REFERENCES students(student_id);

    C

    ALTER TABLE student_grades   ADD CONSTRAINT student_id_fk   FOREIGN KEY (student_id) REFERENCES students(student_id);

    D

    ALTER TABLE student grades   ADD NAMED CONSTRAINT student_id_fk   FOREIGN KEY (student_id) REFERENCES students(student_id);

    E

    ALTER TABLE student grades   ADD NAME student_id_fk   FOREIGN KEY (student_id) REFERENCES students(student_id);


    正确答案: A
    解析: 暂无解析

  • 第10题:

    单选题
    View the Exhibit and examine the structure of the EMP table. You executed the following command to add a primary key to the EMP table:   ALTER TABLE emp   ADD CONSTRAINT emp_id_pk  PRIMARY KEY (emp_id)   USING INDEX emp_id_idx;   Which statement is true regarding the effect of the command?()
    A

     The PRIMARY KEY is created along with a new index.

    B

     The PRIMARY KEY is created and it would use an existing unique index.

    C

     The PRIMARY KEY would be created in a disabled state because it is using an existing index.

    D

     The statement produces an error because the USING clause is permitted only in the CREATE TABLE command.


    正确答案: D
    解析: 暂无解析

  • 第11题:

    单选题
    You need to modify the STUDENTS table to add a primary key on the STUDENT_ID column. The table is currently empty.Which statement accomplishes this task?()
    A

    ALTER TABLE students ADD PRIMARY KEY student_id;

    B

    ALTER TABLE students ADD CONSTRAINT PRIMARY KEY (student _ id);

    C

    ALTER TABLE students ADD CONSTRAINT stud _ id _pk PRIMARY KEY (student _ id);

    D

    ALTER TABLE students MODIFY CONSTRAINT stud _ id _pk PRIMARY KEY (student _ id);


    正确答案: B
    解析: 暂无解析

  • 第12题:

    单选题
    要向雇员表中的部门标识列添加FOREIGNKEY约束条件以引用部门表中的标识列,应该使用哪个语句()
    A

    ALTER TABLE雇员MODIFY COLUMN dept_id_fk FOREIGN KEY(部门标识)REFERENCES部门(部门标识)

    B

    ALTER TABLE雇员ADD CONSTRAINT dept_id_fk FOREIGNKEY(部门标识)REFERENCES部门(部门标识)

    C

    ALTER TABLE雇员ADD FOREIGN KEY CONSTRAINT dept_id_fk ON(部门标识)REFERENCES部门(部门标识)

    D

    ALTER TABLE雇员ADD FOREIGN KEY 部门(部门标识)REFERENCES(部门标识)


    正确答案: D
    解析: 暂无解析

  • 第13题:

    评估以下语句: ALTER TABLE employees ADD CONSTRAINT employee_id PRIMARY KEY; 该语句将返回以下哪种结果()

    • A、将返回语法错误
    • B、将向EMPLOYEES表添加约束条件
    • C、将改写EMPLOYEES表的一个现有约束条件
    • D、将启用EMPLOYEES表的一个现有约束条件

    正确答案:C

  • 第14题:

    要向雇员表中的部门标识列添加FOREIGNKEY约束条件以引用部门表中的标识列,应该使用哪个语句()

    • A、ALTER TABLE雇员MODIFY COLUMN dept_id_fk FOREIGN KEY(部门标识)REFERENCES部门(部门标识)
    • B、ALTER TABLE雇员ADD CONSTRAINT dept_id_fk FOREIGNKEY(部门标识)REFERENCES部门(部门标识)
    • C、ALTER TABLE雇员ADD FOREIGN KEY CONSTRAINT dept_id_fk ON(部门标识)REFERENCES部门(部门标识)
    • D、ALTER TABLE雇员ADD FOREIGN KEY 部门(部门标识)REFERENCES(部门标识)

    正确答案:B

  • 第15题:

    数据库中的中的PROFITS表中PRODUCT_NAME与SALE_PERIOD列建立主键。下列哪个语句无法定义这个主键?()

    • A、create table profits(product_name varchar2(10),sale_perion varchar2(10),profit number, constraint pk_profits_01 primary key(product_name,sale_period))
    • B、alter table profits add constraint pk_profits_01 primary key(product_name,sale_period)deferrabl
    • C、以上两者都是

    正确答案:B

  • 第16题:

    评估此CREATE TABLE语句的执行结果: CREATE TABLE part( part_id NUMBER, part_name VARCHAR2(25), manufacturer_id NUMBER(9), retail_price NUMBER(7,2) NOT NULL, CONSTRAINT part_id_pk PRIMARY KEY(part_id), CONSTRAINT cost_nn NOT NULL(cost), CONSTRAINT FOREIGN KEY (manufacturer_id) REFERENCES manufacturer(id)); 哪一行会导致产生错误()

    • A、6
    • B、7
    • C、8
    • D、9

    正确答案:B

  • 第17题:

    You executed the following code:   SQL> CERATE TABLE COUNTRY   (COUNTRY_ID CHAR(2) CONSTRAINT COUNTRY_ID_nn NOT NULL,   COUNTRY_NAME VARCHAR2(20),   CURRENCY_NAME VARCHAR2(20),   CONSTRAINT COUNTRY_ID_PK PRIMARY KEY (COUNTRY_ID))   ORGANIZATION INDEX;   Which types of tables will be created automatically?()

    • A、 journal table
    • B、 clustered table
    • C、 mapping table
    • D、 partitioned table

    正确答案:C

  • 第18题:

    You need to modify the STUDENTS table to add a primary key on the STUDENT_ID column. The table is currently empty. Which statement accomplishes this task?()

    • A、ALTER TABLE students ADD PRIMARY KEY _ id;
    • B、ALTER TABLE students ADD CONSTRAINT PRIMARY KEY (student_id);
    • C、ALTER TABLE students ADD CONSTRAINT stud_id_pk PRIMARY KEY student_id;
    • D、ALTER TABLE students ADD CONSTRAINT stud_id_pk PRIMARY KEY (student_id);
    • E、ALTER TABLE students MODIFY CONSTRAINT stud_id_pk PRIMARY KEY (student_id);

    正确答案:D

  • 第19题:

    CREATE TABLE test(t_idINT,t_nmae CHAR(10))后,增加t_sex字段,以下语句正确的是()。

    • A、ALTER TABLE test ADD t_sex CHAR(2)
    • B、ALTER TABLE test ADD t_sex
    • C、ALTER TABLE test ALTER t_sex CHAR(2)
    • D、ALTER TABLE test DROP(t_sex CHAR(2))

    正确答案:A

  • 第20题:

    单选题
    您在公司的数据库中成功创建了名为SALARY的表。您现在要通过向引用EMPLOYEES表的匹配列的SALARY表添加FOREIGNKEY约束条件来建立EMPLOYEES表与SALARY表之间的父/子关系。尚未向SALARY表添加任何数据。应执行以下哪条语句()
    A

    ALTER TABLE salary ADD CONSTRAINT fk_employee_id_01 FOREIGN KEY(employee_id)REFERENCES employees(employee_id)

    B

    ALTER TABLE salary ADD CONSTRAINT fk_employee_id_ FOREIGN KEY BETWEEN salary(employee_id)AND employees(employee_id)

    C

    ALTER TABLE salary FOREIGN KEY CONSTRAINT fk_employee_id_REFERENCES employees(employee_id)

    D

    ALTER TABLE salary ADD CONSTRAINT fk_employee_id_FOREIGN KEY salary(employee_id)=employees(employee_id)


    正确答案: B
    解析: 暂无解析

  • 第21题:

    单选题
    You need to modify the STUDENTS table to add a primary key on the STUDENT_ID column. The table is currently empty. Which statement accomplishes this task?()
    A

    ALTER TABLE students ADD PRIMARY KEY _ id;

    B

    ALTER TABLE students ADD CONSTRAINT PRIMARY KEY (student_id);

    C

    ALTER TABLE students ADD CONSTRAINT stud_id_pk PRIMARY KEY student_id;

    D

    ALTER TABLE students ADD CONSTRAINT stud_id_pk PRIMARY KEY (student_id);

    E

    ALTER TABLE students MODIFY CONSTRAINT stud_id_pk PRIMARY KEY (student_id);


    正确答案: D
    解析: 暂无解析

  • 第22题:

    单选题
    评估以下语句: ALTER TABLE employees ADD CONSTRAINT employee_id PRIMARY KEY; 该语句将返回以下哪种结果()
    A

    将返回语法错误

    B

    将向EMPLOYEES表添加约束条件

    C

    将改写EMPLOYEES表的一个现有约束条件

    D

    将启用EMPLOYEES表的一个现有约束条件


    正确答案: A
    解析: 暂无解析

  • 第23题:

    单选题
    You need to modify the STUDENTS table to add a primary key on the STUDENT_ID column. The table is currently empty. Which statement accomplishes this task?()
    A

    ALTER TABLE students ADD PRIMARY KEY student_id;

    B

    ALTER TABLE students ADD CONSTRAINT PRIMARY KEY (student_id);

    C

    ALTER TABLE students ADD CONSTRAINT stud_id_pk PRIMARY KEY student_id;

    D

    ALTER TABLE students ADD CONSTRAINT stud_id_pk PRIMARY KEY (student_id);

    E

    ALTER TABLE students MODIFY CONSTRAINT stud_id_pk PRIMARY KEY (student_id);


    正确答案: E
    解析: 暂无解析