This set of RDBMS Multiple Choice Questions & Answers (MCQs) focuses on “SQL Data Definition”.
1. Which of the following information does an SQL DDL not specify?
a) The schema for each relation
b) The integrity constraints
c) The operations on the tuples
d) The security and authorization information for each relation
View Answer
Explanation: The SQL DDL does not specify the operations that are supposed to be made on the tuples. DDL means Data definition language, hence it does not include the operations made.
2. Which of the following data types does the SQL standard not support?
a) char(n)
b) String(n)
c) varchar(n)
d) float(n)
View Answer
Explanation: The SQL standard does not support String(n) but it supports char, varchar and float.
3. Which command is used to create a new relation in SQL 4. If a1, a2, a3 are attributes in a relation and S is another relation, which of the following is an incorrect specification of an integrity constraint? 5. What is the syntax to load data into the database? (Consider D as the database and a, b, c as data) 6. Which of the following commands do we use to delete a relation (R) from a database? 7. Which of the following commands do we use to delete all the tuples from a relation (R)? 8. Choose the correct command to delete an attribute A from a relation R 9. create table apartment(ownerID varchar (5), ownername varchar(25), floor numeric(4,0), primary key (ownerID)); 10. What does the notnull integrity constraint do? Sanfoundry Global Education & Learning Series – RDBMS. To practice all areas of RDBMS, here is complete set of 1000+ Multiple Choice Questions and Answers.
a) create table(
b) create relation(
c) new table(
d) new relation(
View Answer
Explanation: We use the create table command to create a new relation in the database. The syntax is
create table(
a) primary key(a1, a2, a3)
b) primary key(a1)
c) foreign key(a1, a2) references S
d) foreign key(a1, a2)
View Answer
Explanation: Whenever the integrity constraint foreign key is mentioned, the attributes that are the foreign keys should always be referenced from the relation in which they are primary keys.
a) enter into D (a, b, c);
b) insert into D values (a, b, c);
c) insert into D (a, b, c);
d) insert (a, b, c) values into D;
View Answer
Explanation: To load data into a database we use the insert into command. The syntax is
insert into D values (a, b, c) where a, b, c are the appropriate values
a) drop table R
b) drop relation R
c) delete table R
d) delete from R
View Answer
Explanation: The drop table command is used to delete a relation from a database whereas the delete table removes all the tuples from a relation
a) delete table R
b) drop table R
c) delete from R
d) drop from R
View Answer
Explanation: The delete from command is used to delete all the tuples in a relation. The drop table totally deletes a relation.
a) alter table R delete A
b) alter table R drop A
c) alter table drop A from R
d) delete A from R
View Answer
Explanation: We can delete an attribute from a relation using the alter table command with the following syntax
alter table
Choose the correct option regarding the above statement
a) The statement is syntactically wrong
b) It creates a relation with three attributes ownerID, ownername, floor in which floor cannot be null.
c) It creates a relation with three attributes ownerID, ownername, floor in which ownerID cannot be null.
d) It creates a relation with three attributes ownerID, ownername, floor in which ownername must consist of at least 25 characters.
View Answer
Explanation: It creates a relation apartment with three attributes as specified. The attribute ownername cannot be null because it is the primary key of the relation.
a) It ensures that at least one tuple is present in the relation
b) It ensures that at least one foreign key is present in the relation
c) It ensures that all tuples have a finite value on a specified attribute
d) It ensures that all tuples have finite attributes on all the relations
View Answer
Explanation: The notnull integrity constraint ensures that all the tuples have a finite value on the specified attribute in the relation. It avoids the specification of null values.