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 (stud

题目

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);
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

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

第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题:

下列说法正确的是()

A.alter table user drop column sex;

B.alter table user add sex varchar(20);

C.alter table user drop sex;

D.alter table user modify id int primary key;


正确答案:D,B,A,C 

第4题:

You need to design a student registration database that contains several tables storing academic information. The STUDENTS table stores information about a student. The STUDENT_GRADES table stores information about the student's grades. Both of the tables have a column named STUDENT_ID. The STUDENT_ID column in the STUDENTS table is a primary key. You need to create a foreign key on the STUDENT_ID column of the STUDENT_GRADES table that points to the STUDENT_ID column of the STUDENTS table. Which statement creates the foreign key?()

  • A、CREATE TABLE student_grades (student_id NUMBER(12),semester_end DATE, gpa NUMBER(4,3), CONSTRAINT student_id_fk REFERENCES (student_id) FOREIGN KEY student (student_id));
  • B、CREATE TABLE student_grades(student_id NUMBER(12),semester_end DATE, gpa NUMBER(4,3), student_id_fk FOREIGN KEY (student_id) REFERENCES students (student_id));
  • C、CREATE TABLE student_grades(student_id NUMBER(12),semester_end DATE, gpa NUMBER(4,3), CONSTRAINT FOREIGN KEY (student_id) REFERENCES student (student_id));
  • D、CREATE TABLE student_grades(student_id NUMBER(12),semester_end DATE, gpa NUMBER(4,3), CONSTRAINT student_id_fk FOREIGN KEY (student_id) REFERENCES students (student_id));

正确答案:D

第5题:

You work in a company which uses SQL Server 2008. You are the administrator of the company database. Now you are in charge of a SQL Server 2008 instance. There is a database named named Dworks in the instance. The Dworks table has a table named BillDetails which has a clustered primary key named BillId on the BillId column. The BillDetails table has a single XML column named GoodsDetails. The XML column has an XML index and XML data are stored in this XML column. A new column named GoodsID is added to the BillDetails table. GoodsID must be included in the primary key.  So what action should you perform to achieve this goal?()  

  • A、You should drop the XML index on the table. Modify the primary key. Recreate the XML index 
  • B、You should alter the XML index and set the ALLOW_ROW_LOCKS = OFF option. Alter the primary key and set the ALLOW_ROW_LOCKS = ON option. 
  • C、You should move the XML data to a temporary table. Clear the XML data from the original table by setting the GoodsDetails column to NULL. Modify the primary key. Repopulate the ProductSpecs column. 
  • D、You should disable the XML index on the GoodsDetails column. Modify the primary key.Enable the XML index on the ProductSpecs column.

正确答案:A

第6题:

为表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)

正确答案:D

第7题:

要向雇员表中的部门标识列添加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

第8题:

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

第9题:

Which two statements are true about the primary key constraint in a table? ()

  • A、It is not possible to disable the primary key constraint.
  • B、It is possible to have more than one primary key constraint in a single table.
  • C、The primary key constraint can be referred by only one foreign key constraint.
  • D、The primary key constraint can be imposed by combining more than one column.
  • E、The non-deferrable primary key constraint creates an unique index on the primary key column if it is not already indexed.

正确答案:D,E

第10题:

Which statement adds a constraint that ensures the CUSTOMER_NAME column of the CUSTOMERS table holds a value?()

  • A、ALTER TABLE customers ADD CONSTRAINT cust_name_nn CHECK customer_name IS NOT NULL;
  • B、ALTER TABLE customers MODIFY CONSTRAINT cust_name_nn CHECK customer_name IS NOT NULL;
  • C、ALTER TABLE customers MODIFY customer_name CONSTRAINT cust_name_nn NOT NULL;
  • D、ALTER TABLE customers MODIFY customer_name CONSTRAINT cust_name_nn IS NOT NULL;
  • E、ALTER TABLE customers MODIFY name CONSTRAINT cust_name_nn NOT NULL;
  • F、ALTER TABLE customers ADD CONSTRAINT cust_name_nn CHECK customer_name NOT NULL;

正确答案:C

更多相关问题