Database Modeling and Design MCQs with Answers
Practice important Database Modeling and Design MCQs with answers and explanations.
Multiple Choice Questions
Q231: To create a table named "Floor" with a composite primary key, which DDL statement is correct?
- A: Create table Floor (floorno number (10), no_of_apt number (10), bname varchar2 (30) references building (bname), primary key (floorno, bname));
- B: Create table Floor (floorno number (10), no_of_apt number (10), bname varchar2 (30), primary key (floorno, bname));
- C: Create table Floor (floorno number (10), no_of_apt number (10), bname varchar2 (30) references Building (bname), primary key (floorno));
- D: Create table Floor (floorno number (10), no_of_apt number (10), bname varchar2 (30), foreign key (bname) references Building (bname));
View Answer
A
Q232: Fill in the blank: In the command `Create table Building (bname varchar2 (30) primary key, address varchar2 (40), phone number number (10));`, the datatype for the `bname` column is _______.
- A: Number
- B: Date
- C: VarChar2
- D: Integer
View Answer
B
Q233: Fill in the blank: The "Alter Table" command is used to _______ a table by adding new columns or modifying existing ones.
- A: delete
- B: create
- C: modify
- D: remove
View Answer
C
Q234: Fill in the blank: To store a fixed-size number in Oracle, you would use the _______ datatype.
- A: Number
- B: VarChar2
- C: Date
- D: FixedNumber
View Answer
A
Q235: What is the purpose of the INSERT statement in SQL?
- A: To delete rows from a table
- B: To update existing data
- C: To add new data into a table
- D: To create new tables
View Answer
C
Q236: What must be true about the values in an INSERT statement?
- A: Values can be omitted for any column
- B: Every column must have a corresponding value
- C: Only primary key columns must be filled
- D: Referential integrity constraints are optional
View Answer
B
Q237: How can you verify the data insertion in a table?
- A: SELECT * FROM TableName;
- B: DELETE FROM TableName;
- C: UPDATE TableName SET column=value;
- D: TRUNCATE TABLE TableName;
View Answer
A
Q238: What command would you use to add values to only some columns in a table?
- A: INSERT INTO TableName (column1, column2) VALUES (value1, value2);
- B: INSERT INTO TableName VALUES (value1, value2);
- C: INSERT INTO TableName VALUES ();
- D: INSERT INTO TableName (column1, column2) VALUES ();
View Answer
A
Q239: What does the UPDATE statement do in SQL?
- A: Removes all rows from a table
- B: Adds new rows to a table
- C: Modifies existing rows in a table
- D: Creates a new table
View Answer
C
Q240: How can you update multiple columns in a table?
- A: UPDATE TableName SET column1=value1, column2=value2 WHERE condition;
- B: UPDATE TableName VALUES (value1, value2);
- C: INSERT INTO TableName (column1, column2) VALUES (value1, value2);
- D: DELETE FROM TableName WHERE condition;
View Answer
A