Data Definition Language (DDL) Flashcards
7 cards from real SQL practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 Data Definition Language (DDL) flashcards as text
Which DDL statement creates a new database schema?
Answer: CREATE SCHEMA
CREATE SCHEMA defines a new schema (namespace) to organize database objects.
What is the effect of CREATE VIEW?
Answer: It defines a stored query presented as a virtual table
CREATE VIEW stores a query definition that behaves like a virtual table when referenced.
Which statement is used to remove a view from the database?
Answer: DROP VIEW
DROP VIEW deletes the view definition from the database.
When you ALTER a column's data type, what risk should you consider?
Answer: Existing data may be incompatible and cause errors or truncation
Changing a column's type can fail or truncate data if existing values don't fit the new type.
What does the IF EXISTS clause add to a DROP TABLE statement?
Answer: It prevents an error if the table does not exist
DROP TABLE IF EXISTS avoids raising an error when the named table is absent.
Which DDL feature lets a column automatically generate sequential numeric values?
Answer: AUTO_INCREMENT / IDENTITY / SERIAL
Auto-increment mechanisms (AUTO_INCREMENT, IDENTITY, or SERIAL depending on the system) generate sequential numbers automatically.
What does a CASCADE option on DROP TABLE typically do?
Answer: Drops dependent objects like foreign keys and views as well
CASCADE automatically drops objects that depend on the table, such as referencing constraints or views.