itgle.com

单选题What type of constraint is used to ensure that each row inserted into the EMPLOYEE table with a value in the WORKDEPT column has a row with a corresponding value in the DEPTNO column of the DEPARTMENT table?()A A check constraint on the EMPLOYEE tableB

题目
单选题
What type of constraint is used to ensure that each row inserted into the EMPLOYEE table with a value in the WORKDEPT column has a row with a corresponding value in the DEPTNO column of the DEPARTMENT table?()
A

A check constraint on the EMPLOYEE table

B

A unique constraint on the EMPLOYEE table WORKDEPT column

C

A foreign key reference from the DEPARTMENT tables DEPTNO column to the WORKDEPT column of the EMPLOYEE table

D

A foreign key reference from the EMPLOYEE tables WORKDEPT column to the DEPTNO column of the DEPARTMENT table


相似考题

3.Given the following requirements:Create a table to contain employee data, with a unique numeric identifier automatically assigned when a row is added, has an EDLEVEL column that permits only the values ‘C‘, ‘H‘ and ‘N‘, and permits inserts only when a corresponding value for the employee‘s department exists in the DEPARTMENT table.Which of the following CREATE statements will successfully create this table?()A.CREATE TABLE emp ( empno SMALLINT NEXTVAL GENERATED ALWAYS AS IDENTITY, firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL, workdept CHAR(3) NOT NULL, edlevel CHAR(1), PRIMARY KEY emp_pk (empno), FOREIGN KEY emp_workdept_fk ON (workdept) REFERENCES department (deptno), CHECK edlevel_ck VALUES (edlevel IN (‘C‘,‘H‘,‘N‘)), );B.CREATE TABLE emp ( empno SMALLINT NOT NULL GENERATED BY DEFAULT AS IDENTITY, firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL, workdept CHAR(3), edlevel CHAR(1), CONSTRAINT emp_pk PRIMARY KEY (empno), CONSTRAINT emp_workdept_fk FOREIGN KEY (workdept) REFERENCES department (deptno), CONSTRAINT edlevel_ck CHECK edlevel VALUES (‘C‘,‘H‘,‘N‘) );C.CREATE TABLE emp ( empno SMALLINT NEXTVAL GENERATED BY DEFAULT AS IDENTITY, firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL, workdept CHAR(3) NOT NULL, edlevel CHAR(1) CHECK IN (‘C‘,‘H‘,‘N‘)), CONSTRAINT emp_pk PRIMARY KEY (empno), CONSTRAINT emp_workdept_fk FOREIGN KEY department (deptno) REFERENCES (workdept) );D.CREATE TABLE emp ( empno SMALLINT NOT NULL GENERATED BY DEFAULT AS IDENTITY, firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL, workdept CHAR(3), edlevel CHAR(1), CONSTRAINT emp_pk PRIMARY KEY (empno), CONSTRAINT emp_workdept_fk FOREIGN KEY (workdept) REFERENCES department (deptno), CONSTRAINT edlevel_ck CHECK (edlevel IN (‘C‘,‘H‘,‘N‘)) );

参考答案和解析
正确答案: B
解析: 暂无解析
更多“单选题What type of constraint is used to ensure that each row inserted into the EMPLOYEE table with a value in the WORKDEPT column has a row with a corresponding value in the DEPTNO column of the DEPARTMENT table?()A A check constraint on the EMPLOYEE tableB”相关问题
  • 第1题:

    Which of the following can be used to ensure that once a row has been inserted in table TABLEX, the column MAINID in that row cannot be updated?()

    A.Define the column MAINID as NOT UPDATABLE

    B.Define the column MAINID as a PRIMARY KEY

    C.Define the column MAINID as a FOREIGN KEY

    D.Define an UPDATE trigger on table TABLEX


    参考答案:D

  • 第2题:

    What type of constraint can be used to ensure that, in any given row in a table, the value of one column never exceeds the value of another column?()

    • A、Check
    • B、Range
    • C、Referential
    • D、Informational

    正确答案:A

  • 第3题:

    You are planning to import customer data from the Customer table and the Country table in your SQL Server 2000 database into a SQL Server 2005 database. You want to ensure that during the import process,each value in the CountryCode column of the Customer table has a corresponding record in the CountryCode column in the Country table of the SQL Server 2005 database. You define a foreign key between these two tables. Thus,referential integrity will guarantee that the import routine fails if there are any records where a CountryCode value does not exist in the Country table but does exist in the Customer table. You need to ensure that the import process does not fail if records are encountered that do not exist in the Country table. What should you do?()

    • A、Drop the foreign key. Import the data by using the script. Re-create the foreign key.
    • B、Create a CHECK constraint.
    • C、Create a DML INSTEAD OF trigger that writes the failed records to a file or table.
    • D、Create a DML AFTER trigger that writes the failed records to a file or table.

    正确答案:C

  • 第4题:

    What type of constraint is used to ensure that each row inserted into the EMPLOYEE table with a value in the WORKDEPT column has a row with a corresponding value in the DEPTNO column of the DEPARTMENT table?()

    • A、A check constraint on the EMPLOYEE table
    • B、A unique constraint on the EMPLOYEE table WORKDEPT column
    • C、A foreign key reference from the DEPARTMENT tables DEPTNO column to the WORKDEPT column of the EMPLOYEE table
    • D、A foreign key reference from the EMPLOYEE tables WORKDEPT column to the DEPTNO column of the DEPARTMENT table

    正确答案:D

  • 第5题:

    Which of the following can be used to ensure that once a row has been inserted in table TABLEX, the column MAINID in that row cannot be updated?()

    • A、Define the column MAINID as NOT UPDATABLE
    • B、Define the column MAINID as a PRIMARY KEY
    • C、Define the column MAINID as a FOREIGN KEY
    • D、Define an UPDATE trigger on table TABLEX

    正确答案:D

  • 第6题:

    You are responsible for managing the database schema for an order entry application in a SQL Server 2005 database. After a design review, a member of the development staff asks you to add a new column named CommissionRate to the Product table. Because the actual commission rates for all products are not known at this time, each product has a default commission rate of 12 percent. The rate can be modified as necessary. You add the new column. You need to configure the table to assign the default value as efficiently as possible. What should you do?()

    • A、 Create an INSERT trigger to assign the default value to each item in the table. 
    • B、 Create a CHECK constraint to validate the data and to assign the default value to each item in the table. 
    • C、 Create an UPDATE trigger to update the default value for each new item in the table. 
    • D、 Create a DEFAULT constraint to assign the default value specifying the WITH VALUES argument.

    正确答案:D

  • 第7题:

    You are modifying a table named Product in a SQL Server 2005 database. You want to add a new column named FriendlyName to the Product table. A friendly name for each product will be stored in this column. The table currently contains data. The sales department has not yet created a friendly name for each product. FriendlyName is a required value for each product. You want to add this new column by using the least amount of effort. What should you do?()

    • A、Define the new column as NULL.Update the FriendlyName column to the same value as the productName column. Alter the FriendlyName column to be NOT NULL.
    • B、Define the new column as NOT NULL with a default value of ’Undefined.’
    • C、Define the new column as NULL. Use application logic to enforce the data constraint.
    • D、Define the new column as NULL with a default value of ’Undefined.’

    正确答案:B

  • 第8题:

    单选题
    What type of constraint can be used to ensure that, in any given row in a table, the value of one column never exceeds the value of another column?()
    A

    Check

    B

    Range

    C

    Referential

    D

    Informational


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

  • 第9题:

    单选题
    Given the following requirements: Create a table to contain employee data, with a unique numeric identifier automatically assigned when a row is added, has an EDLEVEL column that permits only the values 'C', 'H' and 'N', and permits inserts only when a corresponding value for the employee's department exists in the DEPARTMENT table. Which of the following CREATE statements will successfully create this table?()
    A

    CREATE TABLE emp ( empno SMALLINT NEXTVAL GENERATED ALWAYS AS IDENTITY, firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL, workdept CHAR(3) NOT NULL, edlevel CHAR(1), PRIMARY KEY emp_pk (empno), FOREIGN KEY emp_workdept_fk ON (workdept) REFERENCES department (deptno), CHECK edlevel_ck VALUES (edlevel IN ('C','H','N')), );

    B

    CREATE TABLE emp ( empno SMALLINT NOT NULL GENERATED BY DEFAULT AS IDENTITY, firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL, workdept CHAR(3), edlevel CHAR(1), CONSTRAINT emp_pk PRIMARY KEY (empno), CONSTRAINT emp_workdept_fk FOREIGN KEY (workdept) REFERENCES department (deptno), CONSTRAINT edlevel_ck CHECK edlevel VALUES ('C','H','N') );

    C

    CREATE TABLE emp ( empno SMALLINT NEXTVAL GENERATED BY DEFAULT AS IDENTITY, firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL, workdept CHAR(3) NOT NULL, edlevel CHAR(1) CHECK IN ('C','H','N')), CONSTRAINT emp_pk PRIMARY KEY (empno), CONSTRAINT emp_workdept_fk FOREIGN KEY department (deptno) REFERENCES (workdept) );

    D

    CREATE TABLE emp ( empno SMALLINT NOT NULL GENERATED BY DEFAULT AS IDENTITY, firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL, workdept CHAR(3), edlevel CHAR(1), CONSTRAINT emp_pk PRIMARY KEY (empno), CONSTRAINT emp_workdept_fk FOREIGN KEY (workdept) REFERENCES department (deptno), CONSTRAINT edlevel_ck CHECK (edlevel IN ('C','H','N')) );


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

  • 第10题:

    单选题
    You are modifying a table named Product in a SQL Server 2005 database. You want to add a new column named FriendlyName to the Product table. A friendly name for each product will be stored in this column. The table currently contains data. The sales department has not yet created a friendly name for each product. FriendlyName is a required value for each product. You want to add this new column by using the least amount of effort. What should you do?()
    A

    Define the new column as NULL.Update the FriendlyName column to the same value as the productName column. Alter the FriendlyName column to be NOT NULL.

    B

    Define the new column as NOT NULL with a default value of ’Undefined.’

    C

    Define the new column as NULL. Use application logic to enforce the data constraint.

    D

    Define the new column as NULL with a default value of ’Undefined.’


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

  • 第11题:

    单选题
    What type of constraint is used to ensure that each row inserted into the EMPLOYEE table with a value in the WORKDEPT column has a row with a corresponding value in the DEPTNO column of the DEPARTMENT table?()
    A

    A check constraint on the EMPLOYEE table

    B

    A unique constraint on the EMPLOYEE table WORKDEPT column

    C

    A foreign key reference from the DEPARTMENT tables DEPTNO column to the WORKDEPT column of the EMPLOYEE table

    D

    A foreign key reference from the EMPLOYEE tables WORKDEPT column to the DEPTNO column of the DEPARTMENT table


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

  • 第12题:

    单选题
    You are planning to import customer data from the Customer table and the Country table in your SQL Server 2000 database into a SQL Server 2005 database. You want to ensure that during the import process,each value in the CountryCode column of the Customer table has a corresponding record in the CountryCode column in the Country table of the SQL Server 2005 database. You define a foreign key between these two tables. Thus,referential integrity will guarantee that the import routine fails if there are any records where a CountryCode value does not exist in the Country table but does exist in the Customer table. You need to ensure that the import process does not fail if records are encountered that do not exist in the Country table. What should you do?()
    A

    Drop the foreign key. Import the data by using the script. Re-create the foreign key.

    B

    Create a CHECK constraint.

    C

    Create a DML INSTEAD OF trigger that writes the failed records to a file or table.

    D

    Create a DML AFTER trigger that writes the failed records to a file or table.


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

  • 第13题:

    What type of constraint can be used to ensure that, in any given row in a table, the value of one column never exceeds the value of another column?()

    A.Check

    B.Range

    C.Referential

    D.Informational


    参考答案:A

  • 第14题:

    Which of the following scenarios will ensure that the value of the NEXT_STEPNO column in a given row of table TABLEX exists as a value of column STEPNO (usually in another row) in the same table?()

    • A、Define a UNIQUE constraint on the columns NEXT_STEPNO and STEPNO.
    • B、Define a CHECK constraint on the NEXT_STEPNO column (NEXT_STEPNO = STEPNO).
    • C、Define column STEPNO as the primary key of TABLEX and column NEXT_STEPNO as a foreign key referencing column STEPNO of the same table.
    • D、Define column NEXT_STEPNO as the primary key of TABLEX and column STEPNO as a foreign key referencing column NEXT_STEPNO in the same table.

    正确答案:C

  • 第15题:

    You are a database administrator for your company. The company uses a SQL Server 2005 database that includes a table named Inventory. The table contains a column named Price. A company policy states that the value in the Price column cannot be decreased by more than 10 percent in any single database operation. Updates to the Price column are made by various means, including by using ad hoc queries. You need to ensure that this company policy is enforced. What should you do?()

    • A、Create a trigger that rolls back changes to the Price column that violate company policy.
    • B、Create a stored procedure that disallows changes to the Price column that violate company policy.
    • C、On the Price column, create a check constraint that requires a specified minimum value.
    • D、On the Price column, create a foreign key constraint to a table that contains valid prices.

    正确答案:A

  • 第16题:

    Given the following requirements: Create a table to contain employee data, with a unique numeric identifier automatically assigned when a row is added, has an EDLEVEL column that permits only the values 'C', 'H' and 'N', and permits inserts only when a corresponding value for the employee's department exists in the DEPARTMENT table. Which of the following CREATE statements will successfully create this table?()

    • A、CREATE TABLE emp ( empno SMALLINT NEXTVAL GENERATED ALWAYS AS IDENTITY, firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL, workdept CHAR(3) NOT NULL, edlevel CHAR(1), PRIMARY KEY emp_pk (empno), FOREIGN KEY emp_workdept_fk ON (workdept) REFERENCES department (deptno), CHECK edlevel_ck VALUES (edlevel IN ('C','H','N')), );
    • B、CREATE TABLE emp ( empno SMALLINT NOT NULL GENERATED BY DEFAULT AS IDENTITY, firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL, workdept CHAR(3), edlevel CHAR(1), CONSTRAINT emp_pk PRIMARY KEY (empno), CONSTRAINT emp_workdept_fk FOREIGN KEY (workdept) REFERENCES department (deptno), CONSTRAINT edlevel_ck CHECK edlevel VALUES ('C','H','N') );
    • C、CREATE TABLE emp ( empno SMALLINT NEXTVAL GENERATED BY DEFAULT AS IDENTITY, firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL, workdept CHAR(3) NOT NULL, edlevel CHAR(1) CHECK IN ('C','H','N')), CONSTRAINT emp_pk PRIMARY KEY (empno), CONSTRAINT emp_workdept_fk FOREIGN KEY department (deptno) REFERENCES (workdept) );
    • D、CREATE TABLE emp ( empno SMALLINT NOT NULL GENERATED BY DEFAULT AS IDENTITY, firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL, workdept CHAR(3), edlevel CHAR(1), CONSTRAINT emp_pk PRIMARY KEY (empno), CONSTRAINT emp_workdept_fk FOREIGN KEY (workdept) REFERENCES department (deptno), CONSTRAINT edlevel_ck CHECK (edlevel IN ('C','H','N')) );

    正确答案:D

  • 第17题:

    The SCOTT user has an index on the ITEM_DESC column of the ITEM table. As part of the year-ending task, SCOTT updates the ITEM_DESC column for most of the rows in the ITEM table. How does this change to the table affect the index?()

    • A、An update in a leaf row takes place.
    • B、The index becomes invalid after the update.
    • C、The leaf block containing the row to be updated is marked as invalid.
    • D、A row in the leaf block of the index for the key value is deleted and inserted.

    正确答案:D

  • 第18题:

    You create a Web Form that displays a GridView. The GridViews data source is a DataSet named dsOrders. The DataSet contains two DataTables named Orders and OrderDetails. You create a relation between the two DataTables using the following code segment. (Line numbers are included for reference only.)01 dtOrders = dsOrders.Tables[“Orders”]; 02 dtOrderDetails = dsOrders.Tables[“OrderDetail”]; 03 colParent = dtOrders.Columns[“OrderID”]; 04 colChild = dtOrderDetails.Columns[“ParentOrderID”]; 05 dsOrders.Relations.Add(“Rell”, colParent, colChild, false); You need to find the cause of the exception being raised in line 05. What should you do? ()

    • A、Ensure that the child column and the parent column have the same names.
    • B、Ensure that the child table and the parent table have the same names.
    • C、Ensure that the child column and the parent column have the same data types.
    • D、Ensure that each row in the child table has a corresponding row in the parent table.
    • E、Ensure that the tables have an explicit relationship defined by a foreign key constraint in the database.

    正确答案:C

  • 第19题:

    单选题
    Which of the following scenarios will ensure that the value of the NEXT_STEPNO column in a given row of table TABLEX exists as a value of column STEPNO (usually in another row) in the same table?()
    A

    Define a UNIQUE constraint on the columns NEXT_STEPNO and STEPNO.

    B

    Define a CHECK constraint on the NEXT_STEPNO column (NEXT_STEPNO = STEPNO).

    C

    Define column STEPNO as the primary key of TABLEX and column NEXT_STEPNO as a foreign key referencing column STEPNO of the same table.

    D

    Define column NEXT_STEPNO as the primary key of TABLEX and column STEPNO as a foreign key referencing column NEXT_STEPNO in the same table.


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

  • 第20题:

    单选题
    The SCOTT user has an index on the ITEM_DESC column of the ITEM table. As part of the year-ending task, SCOTT updates the ITEM_DESC column for most of the rows in the ITEM table. How does this change to the table affect the index?()
    A

    An update in a leaf row takes place.

    B

    The index becomes invalid after the update.

    C

    The leaf block containing the row to be updated is marked as invalid.

    D

    A row in the leaf block of the index for the key value is deleted and inserted.


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

  • 第21题:

    单选题
    You are responsible for managing the database schema for an order entry application in a SQL Server 2005 database. After a design review, a member of the development staff asks you to add a new column named CommissionRate to the Product table. Because the actual commission rates for all products are not known at this time, each product has a default commission rate of 12 percent. The rate can be modified as necessary. You add the new column. You need to configure the table to assign the default value as efficiently as possible. What should you do?()
    A

     Create an INSERT trigger to assign the default value to each item in the table. 

    B

     Create a CHECK constraint to validate the data and to assign the default value to each item in the table. 

    C

     Create an UPDATE trigger to update the default value for each new item in the table. 

    D

     Create a DEFAULT constraint to assign the default value specifying the WITH VALUES argument.


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

  • 第22题:

    单选题
    Which of the following can be used to ensure that once a row has been inserted in table TABLEX, the column MAINID in that row cannot be updated?()
    A

    Define the column MAINID as NOT UPDATABLE

    B

    Define the column MAINID as a PRIMARY KEY

    C

    Define the column MAINID as a FOREIGN KEY

    D

    Define an UPDATE trigger on table TABLEX


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

  • 第23题:

    单选题
    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;


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

  • 第24题:

    单选题
    You are a database administrator for your company. The company uses a SQL Server 2005 database that includes a table named Inventory. The table contains a column named Price. A company policy states that the value in the Price column cannot be decreased by more than 10 percent in any single database operation. Updates to the Price column are made by various means, including by using ad hoc queries. You need to ensure that this company policy is enforced. What should you do?()
    A

    Create a trigger that rolls back changes to the Price column that violate company policy.

    B

    Create a stored procedure that disallows changes to the Price column that violate company policy.

    C

    On the Price column, create a check constraint that requires a specified minimum value.

    D

    On the Price column, create a foreign key constraint to a table that contains valid prices.


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