MCQs on Data Definition Language (DDL) | Oracle Database Structure

Topic 1: Creating, Modifying, and Dropping Tables

  1. Which DDL command is used to create a new table in a database?
    • A) ALTER TABLE
    • B) CREATE TABLE
    • C) DROP TABLE
    • D) MODIFY TABLE
  2. What does the DROP TABLE command do in SQL?
    • A) Deletes all rows from a table without removing its structure
    • B) Modifies the structure of a table
    • C) Removes the table and its structure from the database
    • D) Adds a new column to the table
  3. Which command would you use to remove a column from an existing table?
    • A) ALTER TABLE … DROP COLUMN
    • B) DELETE COLUMN
    • C) REMOVE COLUMN
    • D) DROP TABLE
  4. What does the ALTER TABLE command allow you to do?
    • A) Change data in a table
    • B) Modify the structure of a table
    • C) Delete a table
    • D) Retrieve data from a table
  5. Which command can change the data type of a column in an existing table?
    • A) MODIFY TABLE
    • B) ALTER TABLE
    • C) CHANGE TABLE
    • D) DROP TABLE
  6. If you want to rename a table, which command would you use?
    • A) RENAME TABLE
    • B) MODIFY TABLE
    • C) ALTER TABLE … RENAME TO
    • D) CHANGE TABLE

Topic 2: Creating and Managing Constraints (Primary Key, Foreign Key, Unique, etc.)

  1. Which constraint ensures that all values in a column are unique?
    • A) CHECK
    • B) UNIQUE
    • C) PRIMARY KEY
    • D) FOREIGN KEY
  2. What is the purpose of a primary key constraint in a table?
    • A) To allow NULL values in a column
    • B) To uniquely identify each record in a table
    • C) To reference another table
    • D) To store unique data
  3. Which constraint is used to enforce a relationship between two tables?
    • A) UNIQUE
    • B) PRIMARY KEY
    • C) CHECK
    • D) FOREIGN KEY
  4. When creating a primary key, what must be true about the column?
  • A) It can contain NULL values
  • B) It must contain unique values
  • C) It can contain duplicate values
  • D) It can reference another table
  1. Which constraint prevents a NULL value from being entered in a specific column?
  • A) PRIMARY KEY
  • B) NOT NULL
  • C) UNIQUE
  • D) FOREIGN KEY
  1. What does a CHECK constraint do in a table?
  • A) Limits the range of values in a column
  • B) Ensures uniqueness of values in a column
  • C) Enforces relationships between tables
  • D) Prevents NULL values

Topic 3: Working with Indexes

  1. What is an index in SQL?
  • A) A command to add a new column
  • B) A way to optimize data retrieval speed
  • C) A way to delete records faster
  • D) A command to create tables
  1. Which command is used to create an index on a column?
  • A) ALTER TABLE
  • B) CREATE INDEX
  • C) MODIFY INDEX
  • D) ADD INDEX
  1. What is a unique index?
  • A) An index that only stores non-duplicate values
  • B) An index that is automatically created by SQL
  • C) An index created on a primary key column
  • D) An index that can only be applied to string values
  1. What is the main purpose of using indexes?
  • A) To decrease data storage requirements
  • B) To speed up retrieval of records
  • C) To add more columns to tables
  • D) To allow duplicate entries
  1. How can you delete an existing index in SQL?
  • A) DROP INDEX
  • B) DELETE INDEX
  • C) REMOVE INDEX
  • D) ALTER INDEX
  1. Which type of index would you use to ensure unique values in a column?
  • A) Clustered Index
  • B) Unique Index
  • C) Foreign Key Index
  • D) Sorted Index

Topic 4: Creating and Managing Views

  1. What is a view in SQL?
  • A) A stored query that appears as a virtual table
  • B) A physical copy of a table
  • C) A way to store data on disk
  • D) A command to modify tables
  1. Which command is used to create a view in SQL?
  • A) CREATE VIEW
  • B) CREATE TABLE AS VIEW
  • C) SELECT VIEW
  • D) MODIFY VIEW
  1. Can a view include data from multiple tables?
  • A) No, it can only include data from one table
  • B) Yes, it can include data from multiple tables
  • C) Only if the tables have a primary key
  • D) Only if the tables are in the same database
  1. How do you remove a view from a database?
  • A) DROP TABLE
  • B) DROP VIEW
  • C) DELETE VIEW
  • D) REMOVE VIEW
  1. Which command would you use to update an existing view?
  • A) ALTER VIEW
  • B) MODIFY VIEW
  • C) CHANGE VIEW
  • D) UPDATE VIEW
  1. When is a view useful?
  • A) For optimizing insert statements
  • B) For creating backups
  • C) For simplifying complex queries
  • D) For permanently storing data

Topic 5: Using Sequences and Synonyms

  1. What is a sequence in SQL?
  • A) A set of data points in a table
  • B) An object that generates sequential numbers
  • C) A command to update tables
  • D) A way to delete records
  1. Which command is used to create a sequence in SQL?
  • A) CREATE TABLE
  • B) CREATE SEQUENCE
  • C) ALTER SEQUENCE
  • D) NEW SEQUENCE
  1. Which SQL function would you use to get the next value in a sequence?
  • A) NEXT_VALUE
  • B) NEXTVAL
  • C) CURRENTVAL
  • D) VALUE_INCREMENT
  1. What is a synonym in SQL?
  • A) A synonym is an alias for a table or other object
  • B) A synonym is a primary key constraint
  • C) A synonym is an index for a column
  • D) A synonym is a unique constraint
  1. Why might you create a synonym in a database?
  • A) To increase data retrieval speed
  • B) To simplify access to database objects
  • C) To add constraints
  • D) To create backups
  1. How do you remove a sequence in SQL?
  • A) DELETE SEQUENCE
  • B) DROP SEQUENCE
  • C) REMOVE SEQUENCE
  • D) ALTER SEQUENCE

Answers

QnoAnswer
1B) CREATE TABLE
2C) Removes the table and its structure from the database
3A) ALTER TABLE … DROP COLUMN
4B) Modify the structure of a table
5B) ALTER TABLE
6C) ALTER TABLE … RENAME TO
7B) UNIQUE
8B) To uniquely identify each record in a table
9D) FOREIGN KEY
10B) It must contain unique values
11B) NOT NULL
12A) Limits the range of values in a column
13B) A way to optimize data retrieval speed
14B) CREATE INDEX
15A) An index that only stores non-duplicate values
16B) To speed up retrieval of records
17A) DROP INDEX
18B) Unique Index
19A) A stored query that appears as a virtual table
20A) CREATE VIEW
21B) Yes, it can include data from multiple tables
22B) DROP VIEW
23A) ALTER VIEW
24C) For simplifying complex queries
25B) An object that generates sequential numbers
26B) CREATE SEQUENCE
27B) NEXTVAL
28A) A synonym is an alias for a table or other object
29B) To simplify access to database objects
30B) DROP SEQUENCE

Use a Blank Sheet, Note your Answers and Finally tally with our answer at last. Give Yourself Score.

X
error: Content is protected !!
Scroll to Top