Sei sulla pagina 1di 3

(1) _______ constraint is used to maintain consistency among tuples in two relations.

a) key

b) domain

c) referential-integrity

d) entity-integrity

(2) In case of entity integrity, the primary key may be


(A) not Null (B) Null
(C) both Null & not Null. (D) any value.

(3) A primary key is combined with a foreign key creates


(A) Parent-Child relation ship between the tables that connect them.
(B) Many to many relationship between the tables that connect them.
(C) Network model between the tables that connect them.
(D) None of the above.

(4) The Primary key must be:

a) NOT NULL
b) unique
c) option A and B
d) option A or B

(5) NULL is

a) the same as 0 for integer


b) the same as blank for character
c) the same as 0 for integer and blank for character
d) not a value

(6) The property (or set of properties) that uniquely defines each row in a table is called the:

A) identifier B) index C) primary key D) symmetric key

(7) The null value of an attribute indicates ______ value.

a) zero b) unknown c) infinite d) error


(8) When there is more than one key in a relation, then each such key is called ______.

a) primary b) useful c) multiple d) candidate

(9) A Foreign Key is

A) A field in a table that matches a key field in another table


B) A field in a table that contains data that is also contained elsewhere in another table
C) A field in a table that has the same name as a key field in another table
D) A field in a table that has the same name as a key field in another table

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

(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 ADD CONSTRAINT stud_id_pk PRIMARY KEY (student_id);

(12) Create table Employee(Emp_id numeric not null, Name varchar(20) , dept_name
varchar(20), Salary numeric, unique(Emp_id,Name));

insert into Employee values(1002, ‘Ross’, ‘CSE’, 10000)


insert into Employee values(1006,’Ted’,’Finance’, );
insert into Employee values(1001,’Rita’,’Sales’,20000);
What will be the result of the query?
a) All statements executed
b) Error in create statement
c) Error in insert into Employee values(1006,’Ted’,’Finance’, );
d) Error in insert into Employee values(1008,’Ross’,’CSE’,20000);

e ) Error in insert into Employee values(1001,’Rita’,’Sales’,20000);

(13) Foreign key is the one in which the ________ of one relation is referenced in
another relation.
a) Foreign key
b) Primary key
c) References
d) Check constraint

(14) Create table course


(...
foreign key (dept name) references department
. . . );
Which of the following is used to delete the entries in the referenced table when the
tuple is deleted in course table?
a) Delete
b) Delete cascade
c) Set null
d) All of the mentioned

Potrebbero piacerti anche