Consider the database schema with the following SQL relation declarations: CREAT
ID: 3851915 • Letter: C
Question
Consider the database schema with the following SQL relation declarations: CREATE TABLE R (AINT, BINT, C CHAR(30)); CREATE TABLE S (DINT); Consider each of the following parts separately; that is, start fresh with the above relation definition for each part. in each case, if it is not possible, state so, clearly explaining why. Specify that attributes A and C in R together form a primary key. Specify that attributes A or C in R are keys but only C is the primary key. Specify that attribute A in R may not take on the value NULL in each of the following ways: 1- As one or more attribute based constraints; 2- As one or more general assertions. Specify that there is a referential integrity constraint from attribute D (the foreign key) in S to attribute A (the primary key) in R, in each of the following ways: 1- As a referential integrity constraint; 2- As one or more attribute based constraints; 3- As one or more general assertions. Specify that for each tuple of R the value of attribute A must be at least twice the value of attribute B, in each of the following ways: 1- As one or more attribute based constraints; 2- As one or more tuple based constraints: 3- As one or more general assertions.Explanation / Answer
a. False,attributes a and c don't form a primary key as primary keys cannot have null values and they should be unique as well. As there are no constraints on the table , a and c and have non unique values or null values hence they are not primary key.
b.False , similar to above , there is no not null and unique constraint over C , hence it cannot be a primary key
c. 1. if not null or primary key constraint is there.
d. 1. referential integrity constraint is equivalent to foreign key constraint.
e. 2. tuple based constraint as shown