单项选择题Which of the following constraint types can be used to ensure the value of an INTEGER column references only positive values?()

A.Unique
B.Check
C.Referential
D.Informational


您可能感兴趣的试卷

你可能感兴趣的试题

1.单项选择题A view is created with the following statement:CREATE VIEW v1 AS SELECT col1, col2, col3 FROM t1 WHERE col4 > 1000 ; When will DB2 access the data from table T1 for view V1?()

A.When view V1 is created
B.Each time the REFRESH VIEW v1 statement is executed
C.Each time an SQL statement is executed against view V1
D.Only the first time an SQL statement is executed against view V1

2.单项选择题

A table was created using the following DDL:
CREATE TABLE employee (id SMALLINT NOT NULL, name VARCHAR(9), dept SMALLINT CHECK (dept BETWEEN 10 AND 100),
job CHAR(10) CHECK (job IN ('Sales','Mgr','Clerk')), hiredate DATE, salary DECIMAL(7,2), comm DECIMAL(7,2), PRIMARY KEY (id), CONSTRAINT yearsal CHECK (YEAR(hiredate) > 2004 OR salary > 80500) );
Which of the following INSERT statements will fail?()

A.INSERT INTO employee VALUES (2, 'Smith', 80, 'Mgr', '09/03/2006', 80000, NULL)
B.INSERT INTO employee VALUES (4, 'Smith', 86, 'Mgr', '07/14/2003', 90000, NULL)
C.INSERT INTO employee VALUES (1, 'Smith', 55, 'Sales', '07/14/2003', NULL, NULL)
D.INSERT INTO employee VALUES (3, 'Smith', 33, 'Analyst', '11/26/2006', 90000, NULL)

3.单项选择题

An application needs a table for each connection that tracks the ID and Name of all items previously ordered and committed within the connection. The table also needs to be cleaned up and automatically removed each time a connection is ended. Assuming the ITEMS table was created with the following SQL statement:
CREATE TABLE items item_no INT, item_name CHAR(5), item_qty INT)
Which of the following SQL statements will provide the table definition that meets the specified requirements?()

A.DECLARE GLOBAL TEMPORARY TABLE tracker AS (SELECT item_no, item_name FROM items) WITH NO DATA ON COMMIT PRESERVE ROWS ON DISCONNECT DROP TABLE
B.DECLARE GLOBAL TEMPORARY TABLE tracker AS (SELECT item_no, item_name FROM items) WITH NO DATA ON COMMIT PRESERVE ROWS
C.CREATE TABLE systmp.tracker AS (SELECT item_num, item_name FROM items) WITH NO DATA ON COMMIT PRESERVE ROWS
D.CREATE TABLE tracker AS (SELECT item_num, item_name FROM items) ON COMMIT PRESERVE ROWS ON DISCONNECT DROP TABLE

4.单项选择题Which of the following database objects can be used to raise an error if a table is updated?()

A.Package
B.Trigger
C.Stored Procedure
D.Informational Constraint

5.单项选择题Which of the following is a characteristic of a schema?()

A.Foreign key references cannot cross schema boundaries.
B.A DB2 user must be created before a schema with the same name can be created.
C.If no schema is specified when an object is created, the default schema PUBLIC is used.
D.A schema enables the creation of multiple objects in a database without encountering namespace collisions.

6.单项选择题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.

8.单项选择题

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')) );

9.单项选择题When defining a referential constraint between the parent table T2 and the dependent table T1, which of the following is true?()

A.The list of column names in the FOREIGN KEY clause can be a subset of the list of column names in the primary key of T2 or a UNIQUE constraint that exists on T2.
B.The list of column names in the FOREIGN KEY clause can be a subset of the list of column names in the primary key of T1 or a UNIQUE constraint that exists on T1.
C.The list of column names in the FOREIGN KEY clause must be identical to the list of column names in the primary key of T2 or a UNIQUE constraint that exists on T2.
D.The list of column names in the FOREIGN KEY clause must be identical to the list of column names in the primary key of T1 or a UNIQUE constraint that exists on T1.

10.单项选择题

Given the following two tables:
TAB1 C1 C2
A 11 B 12 C 13 TAB2 CX CY
A 21 C 22 D 23
The following results are desired:
C1 C2 CX CY
A 11 A 21 C 13 C 22 -- --D 23
Which of the following queries will yield the desired results?()

A.SELECT * FROM tab1 INNER JOIN tab2 ON c1=cx
B.SELECT * FROM tab1 LEFT OUTER JOIN tab2 ON c1=cx
C.SELECT * FROM tab1 FULL OUTER JOIN tab2 ON c1=cx
D.SELECT * FROM tab1 RIGHT OUTER JOIN tab2 ON c1=cx

最新试题

A table was created using the following DDL:CREATE TABLE employee (id SMALLINT NOT NULL, name VARCHAR(9), dept SMALLINT CHECK (dept BETWEEN 10 AND 100),job CHAR(10) CHECK (job IN ('Sales','Mgr','Clerk')), hiredate DATE, salary DECIMAL(7,2), comm DECIMAL(7,2), PRIMARY KEY (id), CONSTRAINT yearsal CHECK (YEAR(hiredate) > 2004 OR salary > 80500) );Which of the following INSERT statements will fail?()

题型:单项选择题

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?()

题型:单项选择题

Given the following stored procedure:CREATE PROCEDURE increase_salary ( IN p_workdept CHAR(6), OUT p_sum DECIMAL(9,2) ) SET p_sum = (SELECT SUM(salary) FROM employee WHERE workdept=p_workdept);How can this stored procedure be called from the Command Line Processor?()

题型:单项选择题

A UDT is a data type which:()

题型:单项选择题

Which of the following actions may cause a trigger to be fired?()

题型:单项选择题

An application needs a table for each connection that tracks the ID and Name of all items previously ordered and committed within the connection. The table also needs to be cleaned up and automatically removed each time a connection is ended. Assuming the ITEMS table was created with the following SQL statement:CREATE TABLE items item_no INT, item_name CHAR(5), item_qty INT)Which of the following SQL statements will provide the table definition that meets the specified requirements?()

题型:单项选择题

Assuming PUBLIC has been granted all privileges on table T1, which of the following statements would continue to permit any user to add rows to table T1, but not remove them?()

题型:单项选择题

A user needs to create a trigger that will update table T2 whenever a row is added to table T1. Assuming the user has all appropriate privileges for table T2, which privilege is required on table T1 to create the trigger?()

题型:单项选择题

Which of the following constraint types can be used to ensure the value of an INTEGER column references only positive values?()

题型:单项选择题

Given the following two tables:TAB1 C1 C2A 11 B 12 C 13 TAB2 CX CYA 21 C 22 D 23The following results are desired:C1 C2 CX CYA 11 A 21 C 13 C 22 -- --D 23Which of the following queries will yield the desired results?()

题型:单项选择题