CSS - PMS - CCE - PCS - Basic Computing
Database Basics
The SQL BETWEEN operator normally includes:
A. Both boundary values
B. Neither boundary value
C. Only the lower boundary
D. Only the upper boundary
Correct Answer: A
BETWEEN is inclusive of both the lower and upper boundary values.
CSS - PMS - CCE - PCS - Basic Computing
Database Basics
Which operator tests whether a value belongs to a list?
A. IN
B. LIKE
C. BETWEEN
D. AS
Correct Answer: A
IN checks whether an expression matches any value in a specified list or subquery.
CSS - PMS - CCE - PCS - Basic Computing
Database Basics
In a LIKE pattern, the underscore (_) represents:
A. Exactly one character
B. Any sequence of characters
C. A NULL value
D. A table name
Correct Answer: A
The underscore wildcard matches exactly one character.
CSS - PMS - CCE - PCS - Basic Computing
Database Basics
In a LIKE pattern, the percent sign (%) represents:
A. Any sequence of characters
B. Exactly one character
C. Only numeric values
D. A primary key
Correct Answer: A
The percent wildcard matches zero or more characters.
CSS - PMS - CCE - PCS - Basic Computing
Database Basics
Which operator is used for pattern matching in SQL?
A. LIKE
B. BETWEEN
C. IN
D. IS NULL
Correct Answer: A
LIKE performs pattern matching, commonly with percent and underscore wildcards.
CSS - PMS - CCE - PCS - Basic Computing
Database Basics
Which keyword removes duplicate rows from a SELECT result?
A. DISTINCT
B. UNIQUE TABLE
C. REMOVE
D. DELETE
Correct Answer: A
DISTINCT returns only unique combinations of the selected column values.
CSS - PMS - CCE - PCS - Basic Computing
Database Basics
What is the default sort direction of ORDER BY in most SQL systems?
A. Ascending
B. Descending
C. Random
D. Unsorted only
Correct Answer: A
ORDER BY normally sorts in ascending order unless DESC is specified.
CSS - PMS - CCE - PCS - Basic Computing
Database Basics
Which clause sorts query results?
A. ORDER BY
B. GROUP BY
C. WHERE
D. VALUES
Correct Answer: A
ORDER BY sorts result rows by one or more columns.
CSS - PMS - CCE - PCS - Basic Computing
Database Basics
Which clause filters individual rows before grouping?
A. WHERE
B. HAVING
C. ORDER BY
D. AS
Correct Answer: A
WHERE filters rows before grouping and aggregation are performed.
CSS - PMS - CCE - PCS - Basic Computing
Database Basics
Which SQL command marks a point inside a transaction for partial rollback?
A. SAVEPOINT
B. SELECT
C. ALTER
D. TRUNCATE
Correct Answer: A
SAVEPOINT creates a named point to which a transaction can later be rolled back.
CSS - PMS - CCE - PCS - Basic Computing
Database Basics
Which SQL command cancels uncommitted transaction changes?
A. ROLLBACK
B. COMMIT
C. GRANT
D. CREATE
Correct Answer: A
ROLLBACK reverses changes made since the transaction began or since a savepoint.
CSS - PMS - CCE - PCS - Basic Computing
Database Basics
Which SQL command permanently saves a transaction?
A. COMMIT
B. ROLLBACK
C. SELECT
D. DROP
Correct Answer: A
COMMIT makes the changes made in the current transaction permanent.
CSS - PMS - CCE - PCS - Basic Computing
Database Basics
COMMIT, ROLLBACK, and SAVEPOINT belong to:
A. TCL
B. DDL
C. DQL
D. HTML
Correct Answer: A
Transaction Control Language commands manage database transactions.
CSS - PMS - CCE - PCS - Basic Computing
Database Basics
GRANT and REVOKE belong to:
A. DCL
B. DML
C. DDL
D. DQL
Correct Answer: A
Data Control Language commands manage permissions and access rights.
CSS - PMS - CCE - PCS - Basic Computing
Database Basics
INSERT, UPDATE, and DELETE belong to:
A. DML
B. DDL
C. DCL
D. CSS
Correct Answer: A
Data Manipulation Language commands insert, change, and remove table data.
CSS - PMS - CCE - PCS - Basic Computing
Database Basics
CREATE, ALTER, and DROP belong to:
A. DDL
B. DCL
C. TCL
D. HTML
Correct Answer: A
Data Definition Language commands define or change database structures.
CSS - PMS - CCE - PCS - Basic Computing
Database Basics
Which SQL command quickly removes all rows while keeping the table structure?
A. TRUNCATE TABLE
B. DROP TABLE
C. CREATE TABLE
D. ALTER TABLE
Correct Answer: A
TRUNCATE TABLE removes all rows but keeps the table structure for future use.
CSS - PMS - CCE - PCS - Basic Computing
Database Basics
Which SQL command removes a table definition and its data?
A. DROP TABLE
B. DELETE ROW
C. SELECT TABLE
D. ORDER TABLE
Correct Answer: A
DROP TABLE removes the table object, including its structure and stored rows.
CSS - PMS - CCE - PCS - Basic Computing
Database Basics
Which SQL command changes the structure of an existing table?
A. ALTER TABLE
B. SELECT TABLE
C. INSERT TABLE
D. SAVE TABLE
Correct Answer: A
ALTER TABLE changes table structure, such as adding, removing, or modifying columns.
CSS - PMS - CCE - PCS - Basic Computing
Database Basics
Which SQL command creates a new table?
A. CREATE TABLE
B. SELECT TABLE
C. UPDATE TABLE
D. COMMIT TABLE
Correct Answer: A
CREATE TABLE defines a new table, its columns, data types, and constraints.