2026/2027 | 100% Correct Answers with Complete Solutions |
SQL & Database Management | Pass Guaranteed - A+ Graded
Domain 1: SQL Fundamentals & Syntax (15 Questions)
Q1: A database administrator is designing a table to store employee information. Which
SQL data type is most appropriate for storing a phone number that includes
parentheses and dashes (e.g., (555) 123-4567)?
A. INT
B. DECIMAL(10,0)
C. VARCHAR(20)
D. DATE
Correct Answer: C [CORRECT]
Rationale: VARCHAR(20) (Option C) is the appropriate data type for storing formatted
phone numbers containing non-numeric characters such as parentheses, spaces, and
dashes. VARCHAR (Variable Character) stores alphanumeric strings of varying length
,up to the specified maximum. INT (Option A) and DECIMAL (Option B) are numeric data
types that cannot store non-numeric characters; attempting to insert "(555) 123-4567"
would cause a conversion error. DATE (Option D) stores calendar dates only. While
some designers store phone numbers as integers (removing formatting), the
requirement to preserve formatting makes VARCHAR essential. Additionally, phone
numbers may start with leading zeros (international formats) which would be lost in
numeric types.
Q2: Which SQL statement category is used to retrieve data from database tables
without modifying the data?
A. Data Definition Language (DDL)
B. Data Manipulation Language (DML)
C. Data Query Language (DQL)
D. Data Control Language (DCL)
Correct Answer: C [CORRECT]
Rationale: Data Query Language (DQL) (Option C) consists of SELECT statements used
exclusively to retrieve and query data without changing database structure or content.
DDL (Option A) includes CREATE, ALTER, DROP for schema modification. DML (Option
B) includes INSERT, UPDATE, DELETE for data modification. DCL (Option D) includes
GRANT, REVOKE for permission management. While some classifications combine DQL
,into DML, standard SQL categorization separates SELECT operations as DQL because
they are read-only operations. Understanding these distinctions is critical for database
security and proper statement classification in enterprise environments.
Q3: A developer needs to store a product price with exact precision to two decimal
places. Which data type specification is most appropriate?
A. FLOAT
B. REAL
C. DECIMAL(10,2)
D. INT
Correct Answer: C [CORRECT]
Rationale: DECIMAL(10,2) (Option C) is the correct choice for exact decimal precision,
where 10 represents total digits and 2 represents decimal places. This ensures exact
storage of monetary values without floating-point rounding errors. FLOAT (Option A) and
REAL (Option B) are approximate numeric types that use binary floating-point
representation, causing rounding errors (e.g., 0.1 + 0.2 ≠ 0.3 exactly) unacceptable for
financial calculations. INT (Option D) stores whole numbers only. For financial data,
DECIMAL (or NUMERIC, its synonym) is the industry standard to prevent cumulative
rounding errors in accounting systems.
, Q4: Which SQL keyword is used to eliminate duplicate rows from a result set?
A. UNIQUE
B. DISTINCT
C. GROUP BY
D. ORDER BY
Correct Answer: B [CORRECT]
Rationale: DISTINCT (Option B) is a SELECT clause keyword that removes duplicate
rows from query results, returning only unique combinations of values. UNIQUE (Option
A) is a constraint applied to table columns, not a query keyword. GROUP BY (Option C)
aggregates rows into groups for aggregate functions but doesn't inherently remove
duplicates unless combined with aggregation. ORDER BY (Option D) sorts results
without affecting row uniqueness. Example: SELECT DISTINCT department FROM
employees; returns each department name only once regardless of how many
employees work there. DISTINCT operates on all selected columns combined, not
individual columns.
Q5: In a SQL SELECT statement, which clause is evaluated first by the database engine
during query execution?