SQL Data Definition Language MCQ
SQL Data Definition Language MCQs : This section focuses on the "Data Definition Language (DDL) " of the SQL. These Multiple Choice Questions (mcq) should be practiced to improve the SQL skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.
1. Which is the subset of SQL commands used to manipulate Oracle Database structures, including tables?
A. Data Definition Language(DDL)
B. Data Manipulation Language(DML)
C. DML and DDL
D. None of the Mentioned
View Answer
Ans : A
Explanation: The DDL is used to manage table and index structure.CREATE, ALTER, RENAME, DROP and TRUNCATE statements are the names of few data definition elements.
2. What options did ALTER DATABASE statement add?
A. DATABASE SNAPSHOT syntax
B. ATTACH_REBUILD_LOG clause
C. DB_CHAINING option
D. READ_COMMITTED_SNAPSHOT
View Answer
Ans : D
Explanation: ALTER DATABASE is used for instant file initialization when adding or growing data files.
3. Which of the following is/are the DDL statements?
A. Create
B. Drop
C. Alter
D. All of the Mentioned
View Answer
Ans : D
Explanation: All the mentioned commands are the part of DDL statements.
4. In SQL, which of the following is not a data definition language commands?
A. RENAME
B. REVOKE
C. GRANT
D. UPDATE
View Answer
Ans : A
Explanation: With RENAME statement you can rename a table.RENAME, REVOKE and GRANT are DDL commands and UPDATE is DML command.
5. SQL has how many main commands for DDL:
A. 1
B. 2
C. 3
D. 4
View Answer
Ans : C
Explanation: Create, Delete, Alter these are 3 main command.
6. Which command allows the removal of all rows from a table but flushes a table more efficiently since no rollback information is retained:
A. TRUNCATE command
B. Create command
C. Drop table command
D. Alter table command
View Answer
Ans : A
Explanation: The SQL TRUNCATE TABLE command is used to delete complete data from an existing table.You can also use DROP TABLE command to delete complete table but it would remove complete table structure form the database and you would need to re-create this table once again if you wish you store some data.
7. Which of the following statement removes database including its related components?
A. DROP DATABASE
B. DELETE DATABASE
C. REMOVE DATABASE
D. None of the mentioned
View Answer
Ans : A
Explanation: DROP statement adds support for dropping database snapshots.
8. Point out the correct statement.
A. When a database is dropped, the master database should be backed up
B. You can drop a database currently being used
C. Dropping a database snapshot does not delete the database snapshot from an instance of SQL Server
D. None of the mentioned
View Answer
Ans : A
Explanation: Master database records all of the system level information for a SQL Server.
9. Which of the following statement removes sales and suppliers database?
A. DROP DATABASE Sales, NewSales
B. DROP DATABASE Sales, suppliers
C. DROP DATABASE Sales and suppliers
D. DROP DATABASE Sales-suppliers
View Answer
Ans : B
Explanation: DROP DATABASE can be used for removing multiple databases in one statement.
10. View used used for displaying current status of database is ___________
A. system.databases
B. current.databases
C. sys.databases
D. status.databases
View Answer
Ans : C
Explanation: sys.databases catalog view is used for displaying the present status of the system.
11. Command that is used to add attributes to an existing relation, is said to be
A. Alter
B. Modify
C. Tailor
D. Eliminate
View Answer
Ans : A
Explanation: Command that is used to add attributes to an existing relation, is said to be Alter.
12. All tuples in the relation are assigned null as the value for the new attribute, in the
A. Alter Command
B. Select Command
C. Delete Command
D. Create Command
View Answer
Ans : A
Explanation: All tuples in the relation are assigned null as the value for the new attribute, in the Alter Command.
13. Which requirements can be implemented using a CHECK constraint?
A. Customer must be greater than 21 years old
B. Customer must have a residence in an Asian Country
C. Both A and B
D. None of the above
View Answer
Ans : C
Explanation: Both A and B requirements can be implemented using a CHECK constraint
14. Which requirements can be implemented using a CHECK constraint?
A. Customer must have a name
B. Two customers cannot have same email id
C. Both A and B
D. None of the above
View Answer
Ans : D
Explanation: None of the above requirements can be implemented using a CHECK constraint
15. Which of the following statements are TRUE?
A. A Unique constraint allows multiple rows to have NULL value
B. Integrity constraint can be added to a table even if table data is in violation
C. A PRIMARY KEY allows a single row to contain NULL
D. Both A and B
View Answer
Ans : A
Explanation: A Unique constraint allows multiple rows to have NULL value is the following statements TRUE.
16. Which statement is TRUE regarding ALTER statement?
A. ALTER TABLE cannot be used to remove a column
B. ALTER table can be used to change size of data type, not the data type itself
C. ALTER table can be used to add a column but it must be NOT NULL
D. None of the above
View Answer
Ans : D
Explanation: None of the above statement is TRUE regarding ALTER statement
17. Which statement would add a column CGPA to a table Student which is already created
A. ALTER TABLE Student ADD COLUMN (CGPA NUMBER(3,1));
B. ALTER TABLE Student CGPA NUMBER(3,1);
C. ALTER TABLE Student ADD (CGPA NUMBER(3,1));
D. Both A and C
View Answer
Ans : C
Explanation: ALTER TABLE Student ADD (CGPA NUMBER(3,1)); statement would add a column CGPA to a table Student which is already created.
18. Point out the correct statement.
A. When a database is dropped, the master database should be backed up
B. You can drop a database currently being used
C. Dropping a database snapshot does not delete the database snapshot from an instance of SQL Server
D. None of the mentioned
View Answer
Ans : A
Explanation: Master database records all of the system level information for a SQL Server.
19. All tuples in the relation are assigned null as the value for the new attribute, in the
A. Modify command
B. Tailor command
C. Eliminate command
D. Alter command
View Answer
Ans : D
Explanation: All tuples in the relation are assigned null as the value for the new attribute, in the Alter command
20. To delete a particular column in a relation the command used is:
A. UPDATE TABLE
B. TRUNCATE COLUMN
C. ALTER , DROP
D. DELETE COLUMN
View Answer
Ans : C
Explanation: To delete a particular column in a relation the command used is ALTER , DROP.
Also check :
Discussion