Which SQL command retrieves rows?
A SELECT
B INSERT
C UPDATE
D DROP
Which SQL command creates a table?
A INSERT INTO
B CREATE TABLE
C UPDATE TABLE
D SELECT TABLE
Which SQL command adds rows?
A ALTER
B DROP
C GRANT
D INSERT
Which SQL command changes existing row values?
A CREATE
B UPDATE
C SELECT
D REVOKE
Which SQL command removes selected rows?
A ALTER
B CREATE
C COMMIT
D DELETE
What does WHERE filter in a query?
A Rows before grouping
B Groups after aggregation
C Output column names
D Table definitions
What does ORDER BY control?
A Which rows qualify
B Column data types
C Result row ordering
D Transaction isolation
What does GROUP BY do?
A Sorts rows only
B Deletes duplicate tables
C Creates a foreign key
D Forms groups for aggregation
What does HAVING filter?
A Rows before grouping
B Column names
C Groups after aggregation
D Table constraints
What does COUNT(*) count?
A Nonnull values in column
B All result rows
C Distinct tables
D Columns in the schema
How does COUNT(column) treat NULL values?
A Counts each as one
B Excludes them
C Changes them to zero
D Rejects the query
What does an INNER JOIN return?
A Rows with matching join condition
B All left rows regardless
C All right rows regardless
D Every possible row pair
What does a LEFT JOIN preserve?
A Every row from right table
B Only rows with matches
C Every possible pair
D Every row from left table
What does a CROSS JOIN produce?
A Only matching rows
B Unique key pairs
C Cartesian product
D Sorted rows
What is a self join?
A Table joined with itself
B Two databases merged
C A join without a condition
D Table joined to view
Why use a table alias?
A Short temporary name
B Permanent table rename
C New primary key
D A stored procedure
What does DISTINCT do?
A Sorts rows by key
B Deletes table duplicates
C Removes duplicate result rows
D Changes nulls to zeros
What does LIKE 'A%' match?
A Text ending with A
B Text beginning with A
C Exactly one letter A
D Any number only
What does BETWEEN usually test?
A Exact string equality
B Inclusive value range
C Null presence only
D Foreign key validity
What does IN test?
A Pattern matching only
B Table existence
C Membership in a value list
D Index usage
How should SQL test for null?
A = NULL
B EQUAL NULL
C IN NULL
D IS NULL
What does EXISTS test?
A Whether a column is unique
B Whether a table is indexed
C Whether subquery returns a row
D Whether a transaction committed
What does UNION do by default?
A Combines and removes duplicates
B Combines keeping all duplicates
C Joins rows by key
D Sorts source tables
What does UNION ALL do?
A Removes every duplicate row
B Joins on primary keys
C Updates both source tables
D Combines results retaining duplicates
What does a scalar subquery return?
A One value
B A full database backup
C A table schema only
D Multiple result columns always