SQL and Database Fundamentals
- 111Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
Why is SQL important to everyday digital services such as banking, online shopping, and package tracking?
Why is SQL important to everyday digital services such as banking, online shopping, and package tracking?
111 questions
- 1
Why is SQL important to everyday digital services such as banking, online shopping, and package tracking?
- A
It automatically decides which business actions an organization should take.
- B
It replaces the need for applications to store information in databases.
- C
It is used only to design the visual interfaces of mobile applications.
- D
It provides a standard way for applications to retrieve and manage data in databases.
Correct answer
DIt provides a standard way for applications to retrieve and manage data in databases.
Explanation
SQL is a standard language for communicating with relational databases, which many digital services rely on to retrieve, update, and manage data.
- A
- 2
A retailer wants a list of product names and prices from its sales table. Which SQL approach best expresses that request?
- A
Select every column from the sales table and discard the extras afterward.
- B
Select only the product-name and price columns from the sales table.
- C
Group the sales table by product name and sort it by price.
- D
Update the sales table so that only product names and prices remain.
Correct answer
BSelect only the product-name and price columns from the sales table.
Explanation
The SELECT clause identifies the requested columns, and the FROM clause identifies the table that contains them.
- A
- 3
What does an asterisk in a SELECT list conventionally request?
- A
A count of all the rows in the specified table.
- B
Only columns that are used in a join condition.
- C
All rows that contain a non-null value.
- D
All columns from the specified table or tables.
Correct answer
DAll columns from the specified table or tables.
Explanation
An asterisk is shorthand for selecting all columns. It does not itself filter rows or count them.
- A
- 4
Why is selecting only needed columns usually preferable to selecting every column in a production query?
- A
It prevents the database from applying indexes to the query.
- B
It reduces unnecessary data retrieval and can improve performance and clarity.
- C
It forces the database to return rows in a predictable order.
- D
It automatically removes duplicate records from the results.
Correct answer
BIt reduces unnecessary data retrieval and can improve performance and clarity.
Explanation
Retrieving unnecessary columns increases the amount of data the database must read and return, which can increase I/O and memory use, especially for large tables.
- A
- 5
How can SQL help a retailer make strategic decisions rather than merely process individual sales?
- A
It can guarantee that a product will sell well in a future season.
- B
It can replace all business judgment with automatic database decisions.
- C
It can reveal sales trends, support inventory planning, and help identify unusual patterns.
- D
It can prevent sales data from changing after a transaction is recorded.
Correct answer
CIt can reveal sales trends, support inventory planning, and help identify unusual patterns.
Explanation
SQL can turn large collections of sales records into information useful for identifying trends, optimizing inventory, and spotting patterns that may indicate fraud.
- A
- 6
What is the primary role of the FROM clause in a basic SELECT query?
- A
It specifies the table or tables from which the requested data is retrieved.
- B
It specifies the order in which the returned rows appear.
- C
It specifies the conditions that each returned row must satisfy.
- D
It specifies how duplicate rows are removed from the results.
Correct answer
AIt specifies the table or tables from which the requested data is retrieved.
Explanation
FROM identifies the source table or tables; SELECT identifies the columns to return.
- A
- 7
What does the WHERE clause do in a query that retrieves rows?
- A
It changes the values stored in rows that satisfy a condition.
- B
It limits the results to rows that satisfy a specified condition.
- C
It calculates a summary value for each group of rows.
- D
It combines rows from related tables into a single result.
Correct answer
BIt limits the results to rows that satisfy a specified condition.
Explanation
WHERE filters individual rows, returning only those for which its condition is true.
- A
- 8
Which statement correctly describes common SQL comparison operators?
- A
They can compare numbers but cannot compare dates or text.
- B
They can compare values such as numbers, dates, and text.
- C
They can compare dates only after the dates have been grouped.
- D
They can compare text only when the text values are identical.
Correct answer
BThey can compare values such as numbers, dates, and text.
Explanation
Comparison operators such as equals, not equal, less than, and greater than can be used with appropriate numeric, date, and text values.
- A
- 9
A retailer wants product names that begin with the word "Men's." Which pattern-matching approach fits that request?
- A
Use LIKE with the starting text followed by a percent wildcard.
- B
Use LIKE with a percent wildcard followed by the starting text.
- C
Use DISTINCT with the starting text as the filtering condition.
- D
Use equals with the starting text and omit the rest of the name.
Correct answer
AUse LIKE with the starting text followed by a percent wildcard.
Explanation
A pattern such as
Men's%matches text beginning withMen's; the percent wildcard can represent any sequence of characters, including no characters. - A
- 10
What does the percent wildcard in a LIKE pattern represent?
- A
Any sequence of digits, but not letters or spaces.
- B
Only a digit appearing at the end of a value.
- C
Any sequence of characters, including an empty sequence.
- D
Exactly one character of any kind.
Correct answer
CAny sequence of characters, including an empty sequence.
Explanation
The percent wildcard matches zero or more characters of any kind.
- A
- 11
A query uses
WHERE category = 'sneakers' AND color = 'black'. Which rows qualify?- A
Rows that are sneakers or black, including either condition alone.
- B
Rows that are both sneakers and black.
- C
Rows that are sneakers, regardless of their color.
- D
Rows that are neither sneakers nor black.
Correct answer
BRows that are both sneakers and black.
Explanation
AND requires every condition in the expression to be true for a row to qualify.
- A
- 12
A query uses
WHERE category = 'sneakers' OR manufacturer = 'Puma'. What does it return?- A
Only products that are neither sneakers nor made by Puma.
- B
Only sneakers that are not made by Puma.
- C
Sneakers from any manufacturer and Puma products from any category.
- D
Only Puma sneakers, because both conditions must be true.
Correct answer
CSneakers from any manufacturer and Puma products from any category.
Explanation
OR includes a row when at least one condition is true, so it includes all sneakers and all Puma products.
- A
- 13
Why should parentheses be used when AND and OR appear together in a WHERE clause?
- A
They are required to make any comparison operator valid.
- B
They turn all conditions inside them into optional conditions.
- C
They cause the database to evaluate OR before AND in every expression.
- D
They make the intended grouping explicit and prevent precedence from changing the result.
Correct answer
DThey make the intended grouping explicit and prevent precedence from changing the result.
Explanation
AND has higher precedence than OR, so parentheses clarify which conditions should be grouped together and avoid unintended filtering.
- A
- 14
Without parentheses, how is
category = 'sneakers' OR category = 'boots' AND manufacturer = 'Nike'generally interpreted?- A
All sneakers, or boots made by Nike.
- B
Nike sneakers and Nike boots only.
- C
Nike products that are neither sneakers nor boots.
- D
All sneakers and all boots, regardless of manufacturer.
Correct answer
AAll sneakers, or boots made by Nike.
Explanation
Because AND is evaluated before OR, the expression is interpreted as
category = 'sneakers' OR (category = 'boots' AND manufacturer = 'Nike'). - A
- 15
How should a query group conditions to retrieve only Nike sneakers or Nike boots?
- A
Group the sneaker-or-boot conditions in parentheses, then AND them with the Nike condition.
- B
Group the Nike condition with sneakers, then OR it with the boot condition.
- C
Use OR between all three conditions so any one condition can qualify.
- D
Use AND between all three conditions so every row matches every category.
Correct answer
AGroup the sneaker-or-boot conditions in parentheses, then AND them with the Nike condition.
Explanation
The intended condition is
(category = 'sneakers' OR category = 'boots') AND manufacturer = 'Nike'. - A
- 16
What does the NOT operator do to a condition?
- A
It combines the condition with another condition using AND.
- B
It reverses the condition, selecting rows that do not satisfy it.
- C
It changes a row's stored value to NULL.
- D
It removes duplicate values from the selected columns.
Correct answer
BIt reverses the condition, selecting rows that do not satisfy it.
Explanation
NOT negates a condition, so it selects rows for which that condition is false.
- A
- 17
What is the effect of SELECT DISTINCT when only one column is selected?
- A
It returns every value in its original order, including repetitions.
- B
It returns each different value in that column once.
- C
It returns only values that occur exactly twice.
- D
It sorts the values from smallest to largest automatically.
Correct answer
BIt returns each different value in that column once.
Explanation
DISTINCT eliminates duplicate result rows, so repeated values in a single selected column appear once.
- A
- 18
If a query selects DISTINCT manufacturer and color, which result is considered a duplicate?
- A
Any row with a manufacturer that has appeared before, regardless of color.
- B
Any row with a color that has appeared before, regardless of manufacturer.
- C
A row with the same manufacturer and the same color as another row.
- D
A row with a price that matches another row's price.
Correct answer
CA row with the same manufacturer and the same color as another row.
Explanation
DISTINCT applies to the entire selected combination. For example, a manufacturer's black and white products are different combinations.
- A
- 19
What is the default behavior of ORDER BY when no direction is specified?
- A
It sorts in descending order.
- B
It groups identical values without sorting them.
- C
It preserves the order in which rows were inserted.
- D
It sorts in ascending order.
Correct answer
DIt sorts in ascending order.
Explanation
Ascending order is the default: text generally goes A to Z, numbers from smaller to larger, and dates from earlier to later.
- A
- 20
What does DESC request in an ORDER BY clause?
- A
Removal of duplicate values from the ordered results.
- B
Descending order, such as largest to smallest or latest to earliest.
- C
Ascending order, such as smallest to largest or earliest to latest.
- D
Grouping of rows with matching values in the ordered column.
Correct answer
BDescending order, such as largest to smallest or latest to earliest.
Explanation
DESC specifies descending order; ASC specifies ascending order.
- A
- 21
How does
ORDER BY color ASC, price DESCsort a result?- A
It sorts prices descending, then sorts colors ascending within each price.
- B
It sorts colors and prices both in ascending order.
- C
It sorts colors ascending, then sorts prices descending within each color.
- D
It sorts colors and prices both in descending order.
Correct answer
CIt sorts colors ascending, then sorts prices descending within each color.
Explanation
ORDER BY applies its sort keys in sequence: color is the primary sort, and price is the secondary sort within each color.
- A
- 22
What does ORDER BY change about a query result?
- A
The number of columns selected by the query.
- B
The values stored in the underlying table.
- C
The rows that qualify under the query's filtering conditions.
- D
The sequence in which the returned rows are presented.
Correct answer
DThe sequence in which the returned rows are presented.
Explanation
ORDER BY changes the presentation order of the result; it does not by itself change which data is returned.
- A
- 23
What does GROUP BY allow a query to do?
- A
Combine related tables by matching their key values.
- B
Remove all rows that do not match a condition before retrieval.
- C
Divide rows into groups based on column values for group-level calculations.
- D
Sort every row by a selected column without calculating summaries.
Correct answer
CDivide rows into groups based on column values for group-level calculations.
Explanation
GROUP BY forms groups based on one or more columns, after which aggregate functions can calculate values for each group.
- A
- 24
Which description correctly matches COUNT, SUM, AVG, MIN, and MAX to their functions?
- A
Count distinct tables, add dates, calculate a median, and sort values.
- B
Count rows, add values, calculate an average, find a minimum, and find a maximum.
- C
Count groups, sort values, remove duplicates, find a minimum, and find a maximum.
- D
Count columns, average values, add rows, find a maximum, and find a minimum.
Correct answer
BCount rows, add values, calculate an average, find a minimum, and find a maximum.
Explanation
These aggregate functions count rows, sum numeric values, calculate an average, and identify minimum and maximum values.
- A
- 25
A retailer wants total revenue for each product category. Which query strategy fits that goal?
- A
Group by category and calculate a revenue sum separately for each group.
- B
Filter for one category and count all rows in the whole table.
- C
Select distinct categories without performing a calculation.
- D
Sort by category and select the single highest-priced product.
Correct answer
AGroup by category and calculate a revenue sum separately for each group.
Explanation
Grouping by category creates a group for each category, and an aggregate such as SUM can calculate revenue for each group.
- A
- 26
Why might a query assign an alias such as
total_revenueto a calculated sum?- A
It changes the sum into a stored column in the source table.
- B
It makes the aggregate function ignore duplicate values automatically.
- C
It causes the calculation to be performed before filtering rows.
- D
It gives the calculated result a clear, readable column name.
Correct answer
DIt gives the calculated result a clear, readable column name.
Explanation
An alias provides a readable label for a calculated output column; it does not change the underlying table.
- A
- 27
What is the main purpose of HAVING?
- A
To filter individual rows before the groups are formed.
- B
To sort the final results by an aggregate value.
- C
To filter groups after GROUP BY and aggregation have been applied.
- D
To connect tables that share a foreign key.
Correct answer
CTo filter groups after GROUP BY and aggregation have been applied.
Explanation
HAVING filters aggregated groups, such as categories whose total revenue exceeds a threshold.
- A
- 28
Why is WHERE generally not used to filter on the result of SUM or COUNT?
- A
WHERE is used only for sorting text values.
- B
WHERE removes duplicate groups before aggregate functions run.
- C
WHERE filters individual rows before grouping and aggregation occur.
- D
WHERE runs after HAVING and cannot access any table columns.
Correct answer
CWHERE filters individual rows before grouping and aggregation occur.
Explanation
WHERE operates on individual rows before GROUP BY; HAVING is designed to filter the resulting groups using aggregate conditions.
- A
- 29
Which sequence best describes the conceptual processing order of a grouped query?
- A
GROUP BY, HAVING, FROM and joins, SELECT, WHERE, then ORDER BY.
- B
FROM and joins, WHERE, GROUP BY, HAVING, SELECT, then ORDER BY.
- C
SELECT, ORDER BY, HAVING, GROUP BY, WHERE, then FROM and joins.
- D
WHERE, SELECT, HAVING, FROM and joins, ORDER BY, then GROUP BY.
Correct answer
BFROM and joins, WHERE, GROUP BY, HAVING, SELECT, then ORDER BY.
Explanation
Conceptually, a query identifies source rows through FROM and joins, filters rows with WHERE, forms groups, filters them with HAVING, selects output, and sorts with ORDER BY. A database optimizer may change the physical execution plan.
- A
- 30
Why can filtering rows with WHERE before grouping improve a query?
- A
It guarantees that every group contains the same number of rows.
- B
It causes HAVING to run before GROUP BY.
- C
It reduces the number of rows that later grouping and aggregation must process.
- D
It prevents aggregate functions from calculating values.
Correct answer
CIt reduces the number of rows that later grouping and aggregation must process.
Explanation
Filtering unwanted rows early reduces the data carried into later, potentially costly operations such as grouping and sorting.
- A
- 31
Why can storing customer details alongside every purchase in one large table create problems?
- A
Repeated details prevent the database from storing any foreign keys.
- B
Repeated details make all aggregate functions return incorrect values.
- C
Repeated details create redundancy and make updates prone to inconsistency.
- D
Repeated details force every query to use an outer join.
Correct answer
CRepeated details create redundancy and make updates prone to inconsistency.
Explanation
If a customer's information is repeated across many purchase rows, a change such as an address update must be made in many places, creating opportunities for inconsistent data.
- A
- 32
What is the purpose of normalization in relational database design?
- A
To add indexes to every column in the database.
- B
To combine all related data into a single table for convenient retrieval.
- C
To organize data into related tables and reduce unnecessary repetition.
- D
To ensure every query returns rows in the same order.
Correct answer
CTo organize data into related tables and reduce unnecessary repetition.
Explanation
Normalization strategically separates data into related tables so each table focuses on a particular entity and repeated facts are minimized.
- A
- 33
Which design best illustrates organizing data by entity?
- A
Store customer, product, manufacturer, and sale details in every sale row.
- B
Store all information in one table and rely on sorting to distinguish entities.
- C
Use separate customer, product, manufacturer, and sale tables for their respective information.
- D
Create a separate database for every individual sale.
Correct answer
CUse separate customer, product, manufacturer, and sale tables for their respective information.
Explanation
Normalized designs typically use separate related tables for distinct entities, such as customers, products, manufacturers, and sales.
- A
- 34
What is a primary key?
- A
A column used only to arrange rows in ascending order.
- B
A column that stores a copy of every value from another table.
- C
A column or set of columns that uniquely identifies each row in a table.
- D
A column that may repeat freely because it is used for grouping.
Correct answer
CA column or set of columns that uniquely identifies each row in a table.
Explanation
A primary key uniquely identifies each row in its table, commonly using an identifier such as a customer ID or product ID.
- A
- 35
What is a foreign key used for?
- A
It stores the full contents of the related table in one column.
- B
It assigns a unique identity to every database table.
- C
It automatically removes duplicate rows from a table.
- D
It links a row to a related row by referencing a key in another table.
Correct answer
DIt links a row to a related row by referencing a key in another table.
Explanation
A foreign key in one table contains values that correspond to key values in a related table, linking the records without repeating all their details.
- A
- 36
In a normalized sales design, why can a sale row store a customer ID instead of the customer's full name and address?
- A
The ID lets the sale row avoid having any relationship to a customer.
- B
The ID automatically copies the customer's latest address into every report.
- C
The ID replaces the need for a customer table or a primary key.
- D
The ID refers to the customer's record, where the full details are stored once.
Correct answer
DThe ID refers to the customer's record, where the full details are stored once.
Explanation
The sale table can use a customer ID foreign key to refer to the customer table, avoiding repeated storage of the customer's full details.
- A
- 37
What does an INNER JOIN return when combining two related tables?
- A
Every row from the first table, whether or not a match exists.
- B
Only rows that have no matching value in either table.
- C
Rows with matching values in the columns used to join the tables.
- D
Every row from both tables, whether or not a match exists.
Correct answer
CRows with matching values in the columns used to join the tables.
Explanation
An inner join returns rows for which the join condition finds a match in both tables.
- A
- 38
What happens to a product that has never been sold in an INNER JOIN between product and sale?
- A
It is included with NULL values for every product column.
- B
It is included once for every sale made by another product.
- C
It is excluded because there is no matching sale row.
- D
It is included only if the query sorts products by name.
Correct answer
CIt is excluded because there is no matching sale row.
Explanation
An inner join retains only matching rows, so a product with no corresponding sale is not included in the result.
- A
- 39
Why should a query with joins usually list needed columns explicitly instead of selecting every column?
- A
It avoids unnecessary data and helps distinguish same-named columns from different tables.
- B
It is required for every join to find matching keys.
- C
It guarantees that unmatched rows will appear in the result.
- D
It converts an inner join into a left join.
Correct answer
AIt avoids unnecessary data and helps distinguish same-named columns from different tables.
Explanation
Explicit column selection improves clarity, reduces unnecessary retrieval, and avoids confusion when joined tables contain columns with the same name.
- A
- 40
How can a query retrieve a sale's product and the product's manufacturer name when those details are in three related tables?
- A
Group all three tables by their names and select the matching rows.
- B
Join sale directly to manufacturer without using any relationship between the tables.
- C
Use DISTINCT on sale rows so the missing manufacturer data is added.
- D
Chain joins from sale to product and from product to manufacturer using their key relationships.
Correct answer
DChain joins from sale to product and from product to manufacturer using their key relationships.
Explanation
Joins can be chained along the relationships in the schema, such as sale-to-product and product-to-manufacturer.
- A
- 41
What is the main benefit of table aliases in a query that joins several tables?
- A
They provide shorter temporary names that can make the query easier to read.
- B
They cause the database to exclude rows without matches.
- C
They permanently rename the tables in the database.
- D
They automatically create foreign keys between the tables.
Correct answer
AThey provide shorter temporary names that can make the query easier to read.
Explanation
Aliases such as S, P, and M can abbreviate table names in one query, reducing clutter when referring to columns from multiple tables.
- A
- 42
To find products made by Texas manufacturers and sold to customers in California, which tables may need to be connected?
- A
Customer and manufacturer only.
- B
Sale and customer only.
- C
Product and manufacturer only.
- D
Sale, product, manufacturer, and customer.
Correct answer
DSale, product, manufacturer, and customer.
Explanation
The request needs sale information to connect the customer and product, product information to connect the manufacturer, and customer and manufacturer information to filter their states.
- A
- 43
What is the difference between a LEFT JOIN and an INNER JOIN?
- A
A LEFT JOIN retains every right-table row, while an INNER JOIN retains every left-table row.
- B
A LEFT JOIN retains only matching rows, while an INNER JOIN retains unmatched rows too.
- C
A LEFT JOIN retains every left-table row, while an INNER JOIN retains only matching rows.
- D
A LEFT JOIN combines all rows from both tables, while an INNER JOIN sorts them.
Correct answer
CA LEFT JOIN retains every left-table row, while an INNER JOIN retains only matching rows.
Explanation
A left join keeps all rows from the table listed first and adds matching right-table data where available; an inner join keeps only matches.
- A
- 44
In a LEFT JOIN, what appears in the right-table columns when a left-table row has no match?
- A
NULL values appear in the columns from the right table.
- B
The right table's first row is copied into the result.
- C
The row is removed from the result.
- D
A default value is always generated from the left table.
Correct answer
ANULL values appear in the columns from the right table.
Explanation
A left join preserves the unmatched left row and uses NULL for columns that would have come from the missing right-side match.
- A
- 45
Which description correctly distinguishes RIGHT JOIN and FULL JOIN?
- A
RIGHT JOIN preserves all left-table rows; FULL JOIN preserves only matching rows.
- B
RIGHT JOIN preserves all right-table rows; FULL JOIN preserves unmatched rows from both tables.
- C
RIGHT JOIN returns only matching rows; FULL JOIN preserves all left-table rows only.
- D
RIGHT JOIN removes unmatched rows from both tables; FULL JOIN sorts the matches.
Correct answer
BRIGHT JOIN preserves all right-table rows; FULL JOIN preserves unmatched rows from both tables.
Explanation
A right join preserves all rows from the right table, while a full join preserves rows from both tables, including nonmatching rows.
- A
- 46
What can happen if a join omits its matching condition or uses incorrect join columns?
- A
The query can produce a Cartesian product that pairs every row from one table with every row from the other.
- B
The database removes all rows that do not share identical column names.
- C
The query automatically becomes a left join and fills missing values with NULL.
- D
The query is guaranteed to return one row for each primary key.
Correct answer
AThe query can produce a Cartesian product that pairs every row from one table with every row from the other.
Explanation
Without an appropriate join condition, each row in one table may combine with every row in the other, producing a potentially enormous Cartesian product.
- A
- 47
Why is an explicit JOIN ... ON condition generally preferred to a NATURAL JOIN?
- A
It guarantees that the join returns unmatched rows from both tables.
- B
It eliminates the need to know how the tables relate.
- C
It states the intended relationship clearly instead of relying on matching column names.
- D
It automatically uses every foreign key, even when the tables are unrelated.
Correct answer
CIt states the intended relationship clearly instead of relying on matching column names.
Explanation
A natural join guesses join columns from matching names, so changes in column names can cause surprises; an explicit ON condition makes the relationship clear.
- A
- 48
What is the main purpose of an INSERT statement?
- A
To add new rows to a table.
- B
To change existing values in selected rows.
- C
To remove the table structure and its data.
- D
To remove selected rows from a table.
Correct answer
ATo add new rows to a table.
Explanation
INSERT is a data manipulation language command used to add records to a table.
- A
- 49
Why is it best practice to list target columns explicitly in an INSERT statement?
- A
It prevents the database from checking key constraints.
- B
It clarifies which value goes into which column and makes the statement more resilient to schema changes.
- C
It forces unlisted columns to be deleted from the table.
- D
It guarantees that all inserted values will be non-NULL.
Correct answer
BIt clarifies which value goes into which column and makes the statement more resilient to schema changes.
Explanation
Explicitly listing columns makes value assignments clear and helps the statement continue to work if the table's column order or structure changes.
- A
- 50
What typically happens to a column omitted from an INSERT statement?
- A
It automatically copies its value from the preceding row.
- B
The insert always fails because every column must be listed.
- C
It always receives zero, regardless of its data type.
- D
It receives its defined default value, or typically NULL if no default is defined.
Correct answer
DIt receives its defined default value, or typically NULL if no default is defined.
Explanation
An omitted column uses a defined default when one exists; otherwise it will typically be assigned NULL, subject to the column's constraints.
- A
- 51
What does NULL represent in a database?
- A
The number zero in every numeric column.
- B
A value that is unknown, missing, or not applicable.
- C
An empty string in every text column.
- D
A duplicate of the value in the previous row.
Correct answer
BA value that is unknown, missing, or not applicable.
Explanation
NULL represents missing, unknown, or inapplicable information; it is not the same as zero or an empty string.
- A
- 52
How can a database insert rows selected from another table?
- A
Use INSERT INTO ... SELECT to insert the rows returned by a SELECT query.
- B
Use UPDATE ... ORDER BY to copy the rows into a new table.
- C
Use DELETE ... SELECT to move matching rows between tables.
- D
Use DROP TABLE ... WHERE to copy the selected rows.
Correct answer
AUse INSERT INTO ... SELECT to insert the rows returned by a SELECT query.
Explanation
An INSERT INTO ... SELECT statement can add rows returned by a query, such as copying qualifying older sales into an archive table.
- A
- 53
Why might a database reject an inserted sale whose customer ID does not exist in the customer table?
- A
A table cannot contain a customer ID unless it also stores the customer's full name.
- B
A SELECT statement must run before every INSERT.
- C
A foreign-key constraint protects referential integrity by requiring a valid related customer.
- D
A primary key requires every sale to have a different customer.
Correct answer
CA foreign-key constraint protects referential integrity by requiring a valid related customer.
Explanation
A foreign key can require a referenced customer record to exist, preserving consistency between related tables.
- A
- 54
Why might a database reject an inserted row with a primary-key value that is already in use?
- A
A primary key must match a value in every other table.
- B
A primary key must uniquely identify each row.
- C
A primary key can contain only NULL values.
- D
A primary key is used only for sorting and cannot be inserted.
Correct answer
BA primary key must uniquely identify each row.
Explanation
Primary-key uniqueness prevents two rows in the same table from having the same identifying key value.
- A
- 55
What is the role of the WHERE clause in an UPDATE statement?
- A
It specifies the order in which the changed rows are stored.
- B
It identifies which rows should receive the changes.
- C
It creates a backup of the rows before they change.
- D
It identifies which columns should be returned in a result.
Correct answer
BIt identifies which rows should receive the changes.
Explanation
WHERE limits an update to rows satisfying the specified condition.
- A
- 56
What is the likely effect of running an UPDATE statement without a WHERE clause?
- A
The update is applied only to the first row in the table.
- B
The update changes the table structure but not its rows.
- C
The update is applied to every row in the table.
- D
The database automatically rolls the update back.
Correct answer
CThe update is applied to every row in the table.
Explanation
Without WHERE, an UPDATE has no row filter and applies its changes to every row in the table.
- A
- 57
What is a useful safety check before running an UPDATE statement?
- A
Remove the WHERE condition to see the largest possible result.
- B
Run a SELECT query with the same WHERE condition to inspect the target rows.
- C
Run an ORDER BY clause and assume the first row will be changed.
- D
Run a DROP TABLE statement to clear unrelated data first.
Correct answer
BRun a SELECT query with the same WHERE condition to inspect the target rows.
Explanation
A SELECT using the same condition previews which rows an update will affect, helping verify that the intended records are targeted.
- A
- 58
Why can UPDATE syntax for changes involving multiple tables differ among database systems?
- A
All database systems use exactly the same multi-table update syntax.
- B
Primary keys are optional in one system and required in all others.
- C
SQL systems can support different syntax for joining related tables during an update.
- D
Updates involving multiple tables are never allowed in any database system.
Correct answer
CSQL systems can support different syntax for joining related tables during an update.
Explanation
Database products can differ in how they express updates based on joins, so the syntax supported by the specific system should be checked.
- A
- 59
What does a DELETE statement remove?
- A
The database's entire schema and every table in it.
- B
Rows that satisfy its condition, while leaving the table structure in place.
- C
Only duplicate values in a selected column.
- D
The table's columns and indexes, while retaining all its rows.
Correct answer
BRows that satisfy its condition, while leaving the table structure in place.
Explanation
DELETE removes rows from a table; it does not by itself remove the table's structure.
- A
- 60
What is the risk of running DELETE without a WHERE clause?
- A
Only rows with NULL values are removed.
- B
Every related row in every other table is automatically removed.
- C
The table structure and all its indexes are removed.
- D
Every row in the table is removed, although the table itself remains.
Correct answer
DEvery row in the table is removed, although the table itself remains.
Explanation
Without a condition, DELETE removes all rows from the table but leaves the table structure in place.
- A
- 61
What should be done before deleting rows from a table?
- A
Run a SELECT query using the intended deletion condition to verify the target rows.
- B
Drop any table that contains related information.
- C
Run DELETE without a condition and inspect the table afterward.
- D
Replace the deletion condition with an ORDER BY clause.
Correct answer
ARun a SELECT query using the intended deletion condition to verify the target rows.
Explanation
A SELECT using the same condition previews the rows that would be deleted, reducing the chance of removing unintended data.
- A
- 62
What can happen when a parent record is deleted while child records still reference it under a RESTRICT constraint?
- A
The child foreign keys are always changed to their default values.
- B
The database prevents the deletion to protect the relationship.
- C
The parent record is deleted and its key is reused immediately.
- D
The database automatically deletes all child records.
Correct answer
BThe database prevents the deletion to protect the relationship.
Explanation
RESTRICT prevents deleting a referenced parent while dependent child rows remain, helping preserve referential integrity.
- A
- 63
What is the effect of a CASCADE rule when a referenced parent row is deleted?
- A
Child rows are retained and their foreign keys are always set to NULL.
- B
The parent deletion is always blocked until a backup is made.
- C
The parent row is converted into a soft-deleted record automatically.
- D
Related child rows are automatically deleted as well.
Correct answer
DRelated child rows are automatically deleted as well.
Explanation
With ON DELETE CASCADE, deleting the parent automatically deletes dependent child rows, which can remove substantial related data.
- A
- 64
What can a SET NULL action do when a referenced parent row is deleted?
- A
It replaces each child row's primary key with the parent key.
- B
It prevents the parent row from being deleted in every case.
- C
It deletes the child rows and preserves the parent row.
- D
It sets the referencing foreign-key values in child rows to NULL.
Correct answer
DIt sets the referencing foreign-key values in child rows to NULL.
Explanation
SET NULL breaks the reference by setting the relevant child foreign-key value to NULL, provided the column allows it.
- A
- 65
What is a soft delete?
- A
Moving every deleted row to a different database automatically.
- B
Removing a table and all its data from the database.
- C
Deleting a row only when it has no foreign keys.
- D
Marking a record as inactive or deleted while keeping it physically in the table.
Correct answer
DMarking a record as inactive or deleted while keeping it physically in the table.
Explanation
A soft delete commonly changes a status flag or adds a deletion timestamp, allowing records to remain available for history, reporting, or auditing.
- A
- 66
How does DROP TABLE differ from DELETE?
- A
DROP TABLE changes row values; DELETE creates a new table.
- B
DROP TABLE removes the table structure and its data; DELETE removes rows but leaves the structure.
- C
DROP TABLE and DELETE both remove only rows that satisfy WHERE.
- D
DROP TABLE removes selected rows; DELETE removes the table structure and its indexes.
Correct answer
BDROP TABLE removes the table structure and its data; DELETE removes rows but leaves the structure.
Explanation
DROP TABLE is a structural operation that removes the table and its contents, whereas DELETE removes records while leaving the table defined.
- A
- 67
Why should someone check dependencies before dropping a table?
- A
Other tables, views, or procedures may rely on the table and be affected by its removal.
- B
Dependencies determine the alphabetical order of the table's columns.
- C
A table can be dropped only if it contains no rows.
- D
Checking dependencies automatically creates a backup.
Correct answer
AOther tables, views, or procedures may rely on the table and be affected by its removal.
Explanation
Other database objects may depend on the table, so those relationships should be understood before its structure is removed.
- A
- 68
If table B has a foreign key referencing table A, which table generally needs to be dropped first?
- A
Table A, because it is the referenced parent table.
- B
Either table, because dependency order never matters.
- C
Neither table, because foreign keys prevent all table removal.
- D
Table B, because it is the referencing child table.
Correct answer
DTable B, because it is the referencing child table.
Explanation
A referencing child table generally needs to be dropped before its referenced parent table, because the child depends on the parent.
- A
- 69
What does
DROP TABLE IF EXISTShelp prevent in a script?- A
An error caused solely by the table already being absent.
- B
The need to create a database backup.
- C
The permanent removal of the table if it exists.
- D
A foreign key from referencing the table.
Correct answer
AAn error caused solely by the table already being absent.
Explanation
IF EXISTS allows a script to avoid failing just because the named table does not exist.
- A
- 70
Which priority order is recommended when writing SQL queries?
- A
Readability first, optimization second, and correctness third.
- B
Correctness first, optimization second, and readability last.
- C
Correctness first, readability second, and optimization third.
- D
Optimization first, correctness second, and readability third.
Correct answer
CCorrectness first, readability second, and optimization third.
Explanation
A query must first return the right data, then be understandable and maintainable; performance tuning should follow when justified.
- A
- 71
Why should optimization usually wait until a query is correct and readable?
- A
Optimization changes the database schema rather than query performance.
- B
Readable queries cannot use indexes.
- C
Premature tuning can add complexity without fixing the real performance problem.
- D
Correct queries always run as quickly as possible without tuning.
Correct answer
CPremature tuning can add complexity without fixing the real performance problem.
Explanation
Tuning before confirming correctness and clarity can create unnecessarily complex code and may not address the actual bottleneck.
- A
- 72
What is the main purpose of comments in complex SQL?
- A
To make the database execute each condition more quickly.
- B
To replace the need for clear table and column names.
- C
To force a query to use a particular index.
- D
To explain the reasoning behind non-obvious logic for future readers.
Correct answer
DTo explain the reasoning behind non-obvious logic for future readers.
Explanation
Comments help teammates and future maintainers understand why complex filters or joins were chosen.
- A
- 73
Which practice helps make a query with several joins easier to read?
- A
Place every join condition in an unrelated ORDER BY clause.
- B
Use consistent table aliases and explicit JOIN ... ON conditions.
- C
Use SELECT * and omit all join conditions.
- D
Use natural joins so the database guesses every relationship.
Correct answer
BUse consistent table aliases and explicit JOIN ... ON conditions.
Explanation
Consistent aliases reduce clutter, while explicit ON conditions make table relationships clear and separate join logic from filtering logic.
- A
- 74
How can consistent SQL formatting improve a query?
- A
It prevents NULL values from appearing in results.
- B
It guarantees that the database chooses the fastest execution plan.
- C
It makes selected columns and conditions easier to scan and understand.
- D
It automatically corrects invalid join relationships.
Correct answer
CIt makes selected columns and conditions easier to scan and understand.
Explanation
Consistent capitalization, line breaks, indentation, and comma placement make query structure easier for people to inspect.
- A
- 75
What does an index provide to a database?
- A
A lookup structure that can help locate matching rows without scanning the entire table.
- B
A rule that prevents any updates to indexed data.
- C
A second complete copy of every table that replaces the original.
- D
A guarantee that every query will run in constant time.
Correct answer
AA lookup structure that can help locate matching rows without scanning the entire table.
Explanation
An index stores ordered key values with pointers to table rows, providing a faster path to matching records than a full table scan in suitable queries.
- A
- 76
What may a database have to do when a searched column has no usable index?
- A
Scan rows in the table to find those that meet the search condition.
- B
Convert the search into a foreign-key constraint.
- C
Create a permanent index automatically for every query.
- D
Return only the first row in the table.
Correct answer
AScan rows in the table to find those that meet the search condition.
Explanation
Without a usable index, the database may need to read many or all rows to find matches, which can be slow on large tables.
- A
- 77
Why can creating an index improve SELECT performance?
- A
The index makes every query return fewer columns.
- B
The index prevents the database from reading table data.
- C
The index automatically removes duplicate rows from the table.
- D
The database can use the index to locate relevant rows more quickly.
Correct answer
DThe database can use the index to locate relevant rows more quickly.
Explanation
An index provides a fast lookup path to rows matching a search, join, or sometimes sorting condition.
- A
- 78
Why can too many indexes slow down INSERT, UPDATE, and DELETE operations?
- A
Indexes prevent the database from identifying the changed rows.
- B
Indexes convert every write into a full database backup.
- C
Every index requires all table rows to be deleted and reinserted after a write.
- D
The database must maintain affected indexes as the underlying data changes.
Correct answer
DThe database must maintain affected indexes as the underlying data changes.
Explanation
Indexes can speed up reads, but changes to indexed data require the database to update relevant index structures too.
- A
- 79
Which columns are generally the strongest candidates for indexing?
- A
Columns frequently used in filters, join conditions, or sometimes sorting.
- B
Columns that are never searched or used in joins.
- C
Only columns containing long text descriptions.
- D
Every column, regardless of how often it is changed.
Correct answer
AColumns frequently used in filters, join conditions, or sometimes sorting.
Explanation
Strategic indexing focuses on columns frequently used to locate, join, or order data, while weighing read benefits against write costs.
- A
- 80
What does it mean for a WHERE condition to be sargable?
- A
It automatically creates an index for the filtered column.
- B
It includes an aggregate function that runs after GROUP BY.
- C
It is written so the database can potentially use an index to find matching rows.
- D
It selects every row before applying any condition.
Correct answer
CIt is written so the database can potentially use an index to find matching rows.
Explanation
Sargable means search-argument-able: the condition is expressed in a way that can allow effective use of an index.
- A
- 81
Why can applying a function to an indexed column in a WHERE clause make index use less effective?
- A
The function permanently removes the index from the table.
- B
The function changes the column into a primary key.
- C
The function forces the query to use an outer join.
- D
The database may need to calculate the function for each row before testing the condition.
Correct answer
DThe database may need to calculate the function for each row before testing the condition.
Explanation
A condition such as applying YEAR to a date column may require processing each row's value before comparison, making a direct index lookup difficult.
- A
- 82
If a query needs orders from the year 2023, which approach is more likely to let an index on the order-date column help?
- A
Filter the unmodified date column using the start and end of the year.
- B
Group by date before specifying any date condition.
- C
Sort by date and use the first row as the only result.
- D
Apply a year-extraction function to the date column for every row.
Correct answer
AFilter the unmodified date column using the start and end of the year.
Explanation
A date range condition leaves the indexed column unmodified, making it more likely that the database can use an index on that column.
- A
- 83
Which LIKE pattern is more likely to allow use of an index on a name column?
- A
A pattern with a fixed beginning and a trailing wildcard, such as
Smith%. - B
A pattern with a leading wildcard, such as
%Smith%. - C
A pattern that applies a function to the name column first.
- D
A pattern with wildcards before and after every character.
Correct answer
AA pattern with a fixed beginning and a trailing wildcard, such as
Smith%.Explanation
A leading wildcard often prevents an index from efficiently locating the start of a match, while a fixed prefix followed by a wildcard can often use an index.
- A
- 84
When an exact match is sufficient, why is an equality comparison generally preferred over LIKE?
- A
It expresses the exact-match requirement directly and avoids unnecessary pattern matching.
- B
It permits wildcard characters at the beginning of the value.
- C
It automatically removes duplicate matching rows.
- D
It causes the database to return all values that share the same prefix.
Correct answer
AIt expresses the exact-match requirement directly and avoids unnecessary pattern matching.
Explanation
When a pattern is not needed, an equality comparison is the direct way to express an exact match.
- A
- 85
Why can EXISTS sometimes be more efficient than IN when checking a large subquery result?
- A
EXISTS can stop after finding a match, while IN may need to process the subquery's result.
- B
EXISTS always sorts the subquery, while IN never does.
- C
EXISTS avoids checking whether any matching row is present.
- D
IN always returns duplicate rows, while EXISTS removes them.
Correct answer
AEXISTS can stop after finding a match, while IN may need to process the subquery's result.
Explanation
EXISTS checks whether at least one matching row exists and can stop once it finds one; depending on the query and database, IN may require processing more of the subquery result.
- A
- 86
Why should a query avoid joining tables whose data is not needed?
- A
A query cannot select columns after joining more than two tables.
- B
Every extra join automatically changes the query into a Cartesian product.
- C
Unneeded tables prevent WHERE conditions from being applied.
- D
Unnecessary tables can add processing work without contributing to the requested result.
Correct answer
DUnnecessary tables can add processing work without contributing to the requested result.
Explanation
Joining only necessary tables avoids extra processing and reduces the data the database must handle.
- A
- 87
How can filtering data before joining help performance?
- A
It can reduce the number of rows that the join operation must process.
- B
It automatically changes an outer join into a full join.
- C
It guarantees that no join condition will be needed.
- D
It causes the database to retain all unmatched rows.
Correct answer
AIt can reduce the number of rows that the join operation must process.
Explanation
When applicable, filtering rows before a join reduces the input size and can lower the join's processing cost.
- A
- 88
Why can an INNER JOIN be preferable to an OUTER JOIN when unmatched rows are not needed?
- A
An inner join automatically uses an index on every column.
- B
An inner join always returns every row from both tables.
- C
An inner join does not require a join condition.
- D
An inner join does not need to preserve and represent nonmatching rows.
Correct answer
DAn inner join does not need to preserve and represent nonmatching rows.
Explanation
Outer joins have additional work to preserve unmatched rows and supply NULLs, so an inner join may be more efficient when only matches are needed.
- A
- 89
Why can a join perform better than a correlated subquery in some cases?
- A
A join always avoids reading any table more than once.
- B
A join automatically removes every duplicate row from its result.
- C
The optimizer may handle one join more efficiently than repeatedly evaluating a subquery for outer rows.
- D
A correlated subquery cannot use indexes under any circumstances.
Correct answer
CThe optimizer may handle one join more efficiently than repeatedly evaluating a subquery for outer rows.
Explanation
A correlated subquery may be evaluated in relation to many outer rows, whereas a database optimizer may have efficient strategies for processing a join.
- A
- 90
What is the N+1 query problem in application code?
- A
Creating one index for each of the first N columns in a table.
- B
Running one query that returns more than one row.
- C
Fetching a list with one query, then issuing another query for each item to get related data.
- D
Using a union to combine N result sets with one final result.
Correct answer
CFetching a list with one query, then issuing another query for each item to get related data.
Explanation
The N+1 pattern uses one query to retrieve a list and then repeats a separate query for each item, causing many database round trips.
- A
- 91
What is the difference between UNION and UNION ALL?
- A
UNION sorts source tables, while UNION ALL changes their stored rows.
- B
UNION removes duplicate result rows, while UNION ALL retains them.
- C
UNION combines tables with different column counts, while UNION ALL does not.
- D
UNION retains duplicates, while UNION ALL removes them.
Correct answer
BUNION removes duplicate result rows, while UNION ALL retains them.
Explanation
UNION removes duplicates from combined results; UNION ALL does not.
- A
- 92
When is UNION ALL generally preferable to UNION?
- A
When the SELECT statements return different numbers of columns.
- B
When duplicates are acceptable or known not to occur.
- C
When the result must contain only unique rows.
- D
When every result must be sorted automatically.
Correct answer
BWhen duplicates are acceptable or known not to occur.
Explanation
UNION ALL avoids the extra work of identifying and removing duplicates, so it is generally preferable when duplicate removal is unnecessary.
- A
- 93
What does a query execution plan help a developer determine?
- A
Which table values should be permanently changed.
- B
Which access methods, joins, row estimates, and operations the database uses for a query.
- C
Whether a query's result is ethically justified.
- D
Which business questions a company should ask next.
Correct answer
BWhich access methods, joins, row estimates, and operations the database uses for a query.
Explanation
Tools such as EXPLAIN or an execution-plan viewer show how a database intends to run or ran a query, helping locate performance bottlenecks.
- A
- 94
Which finding in an execution plan could help explain why a query is slow?
- A
A comment explaining why a filter was chosen.
- B
A column name written on a separate line.
- C
An unexpected full table scan, large row expansion, or costly sort.
- D
A clear alias assigned to a table.
Correct answer
CAn unexpected full table scan, large row expansion, or costly sort.
Explanation
Execution plans can reveal expensive operations such as scans, joins that expand row counts, or sorting that consumes significant resources.
- A
- 95
What is a common table expression (CTE)?
- A
A named temporary result set available for one query.
- B
A transaction that cannot be committed or rolled back.
- C
An index that orders every column in a table.
- D
A permanent table that automatically stores every query result.
Correct answer
AA named temporary result set available for one query.
Explanation
A CTE defines a named result set for the duration of a single query and can be referenced in the query that follows its definition.
- A
- 96
How can CTEs help with long, complex queries?
- A
They permanently eliminate the need for joins.
- B
They save intermediate results permanently without additional commands.
- C
They let a query be organized into named logical steps instead of deeply nested subqueries.
- D
They guarantee faster execution than every alternative.
Correct answer
CThey let a query be organized into named logical steps instead of deeply nested subqueries.
Explanation
CTEs can make multi-step queries more modular and readable, although their use does not guarantee better performance.
- A
- 97
What is denormalization?
- A
Automatically indexing every foreign key in a database.
- B
Removing all keys from related tables to simplify updates.
- C
Intentionally adding controlled redundancy to improve read performance or avoid costly joins.
- D
Splitting every column into its own independent table.
Correct answer
CIntentionally adding controlled redundancy to improve read performance or avoid costly joins.
Explanation
Denormalization adds some redundancy by design, often trading greater write complexity or reduced data purity for faster reads.
- A
- 98
Why might a read-heavy reporting system store a customer's state on an order table even if it is already in the customer table?
- A
The duplicated value can avoid a join when reports repeatedly need the state with order data.
- B
A customer table cannot contain a state column when orders exist.
- C
Normalization requires the state to be copied into every order.
- D
The copied value guarantees the customer's current state is always correct.
Correct answer
AThe duplicated value can avoid a join when reports repeatedly need the state with order data.
Explanation
A controlled duplicate may allow frequent reports to read the needed data without joining to the customer table, at the cost of added redundancy.
- A
- 99
What is database partitioning used for with very large tables?
- A
Combining every table in a database into one large table.
- B
Creating a separate database for every row.
- C
Preventing queries from filtering on date ranges.
- D
Physically dividing a table into smaller chunks based on a criterion such as date.
Correct answer
DPhysically dividing a table into smaller chunks based on a criterion such as date.
Explanation
Partitioning divides a large table into manageable sections, such as monthly date ranges, so some queries can focus on relevant partitions.
- A
- 100
Why might a query for recent records run faster on a partitioned table?
- A
It may need to scan only the relevant recent partitions rather than the entire table.
- B
Partitioning removes the need to check any row values.
- C
A partitioned table automatically deletes all older records.
- D
Every partition contains only one row, regardless of table size.
Correct answer
AIt may need to scan only the relevant recent partitions rather than the entire table.
Explanation
When a query's conditions identify particular partitions, the database may avoid scanning unrelated portions of a very large table.
- A
- 101
Where should SQL scripts that modify data be tested?
- A
Only in the database's live environment after business hours.
- B
In a dedicated non-production environment such as development, staging, or a test database.
- C
Directly in production, as long as the script is short.
- D
In any database, provided the query uses an alias.
Correct answer
BIn a dedicated non-production environment such as development, staging, or a test database.
Explanation
Dangerous or unverified scripts should be tested in a controlled environment separate from production.
- A
- 102
Why is it useful for automated database tests to begin with a fresh, known state?
- A
It allows tests to use production data without risk.
- B
It removes the need to verify the results of a test.
- C
It ensures that test failures cannot occur.
- D
It makes results more reliable by controlling the schema and test data for each run.
Correct answer
DIt makes results more reliable by controlling the schema and test data for each run.
Explanation
A known starting state makes tests reproducible and helps ensure that a test's outcome reflects the code being tested rather than leftover data.
- A
- 103
Which sequence best describes a controlled database test?
- A
Load production data, skip verification, then retain all test changes.
- B
Create test data, alter production, and verify only if an error occurs.
- C
Run the code, delete the database, load test data, then create the schema.
- D
Create the schema, load relevant test data, run the code, verify results, and clean up.
Correct answer
DCreate the schema, load relevant test data, run the code, verify results, and clean up.
Explanation
A repeatable test typically sets up a schema and relevant data, executes the code, checks the expected state, and cleans up for the next run.
- A
- 104
How can a transaction make manual testing of an UPDATE or DELETE safer?
- A
It allows changes to be checked and then committed or rolled back.
- B
It removes the need for a WHERE clause.
- C
It prevents SELECT queries from viewing changed rows.
- D
It permanently saves each change before verification.
Correct answer
AIt allows changes to be checked and then committed or rolled back.
Explanation
Within a transaction, changes can be inspected before they are made permanent; COMMIT keeps them, while ROLLBACK undoes them.
- A
- 105
What does ROLLBACK do to changes made since a transaction began?
- A
It drops every table changed in the transaction.
- B
It undoes those changes and restores the earlier database state.
- C
It creates a copy of the changed rows in a new table.
- D
It permanently saves those changes to the database.
Correct answer
BIt undoes those changes and restores the earlier database state.
Explanation
ROLLBACK reverses changes made during the transaction, whereas COMMIT makes them permanent.
- A
- 106
Why might development teams use containers or an in-memory database for testing?
- A
They make it safe to run tests on production records.
- B
They guarantee that a test script cannot contain errors.
- C
They automatically approve all changes to customer data.
- D
They can provide isolated, controlled database instances for tests.
Correct answer
DThey can provide isolated, controlled database instances for tests.
Explanation
Tools such as Docker or an in-memory database can provide separate, controlled environments for testing without changing production data.
- A
- 107
Which production data change is generally more ethically defensible?
- A
Changing past sales figures to make a quarter appear more successful.
- B
Correcting a clear factual error while transparently recording the change.
- C
Removing historical records so auditors cannot review them.
- D
Deleting customer complaints to improve public reports.
Correct answer
BCorrecting a clear factual error while transparently recording the change.
Explanation
Correcting a factual error can support accuracy, whereas manipulating results or concealing unfavorable records undermines trust in the data.
- A
- 108
What governance practice is appropriate for direct modifications to production data?
- A
Make them routinely to correct reports without review.
- B
Allow any user to make them without recording a reason.
- C
Avoid documenting them so later users see only the final values.
- D
Treat them as rare changes that require strong justification and appropriate approval.
Correct answer
DTreat them as rare changes that require strong justification and appropriate approval.
Explanation
Responsible organizations limit direct production changes and require justification and approval because such changes can affect valuable records.
- A
- 109
Which information may an audit trail record for a data change?
- A
Only the table name and the current server temperature.
- B
Who made it, what changed, when it changed, and why.
- C
Only the new value, without identifying the affected row.
- D
Only the person who requested the change, without a timestamp.
Correct answer
BWho made it, what changed, when it changed, and why.
Explanation
Audit trails commonly capture the who, what, when, and why, including details such as the affected record, old and new values, timestamp, and reason.
- A
- 110
Why should a correction itself be recorded in an audit trail?
- A
It replaces the need to preserve the original value.
- B
It makes the change transparent and traceable rather than hiding the data's history.
- C
It proves that every change was automatically correct.
- D
It prevents the corrected value from ever being changed again.
Correct answer
BIt makes the change transparent and traceable rather than hiding the data's history.
Explanation
Logging even legitimate corrections provides an accountable history that auditors and future users can verify.
- A
- 111
How can audit trails support trust in business data?
- A
They make data changes invisible to auditors.
- B
They remove the need for data integrity constraints.
- C
They provide a verifiable history that helps explain changes and support accountability.
- D
They prevent all inaccurate data from ever being entered.
Correct answer
CThey provide a verifiable history that helps explain changes and support accountability.
Explanation
A reliable change history helps answer questions about why values changed, who changed them, and when, supporting accountability and trust.
- A

Ask anything
We've read this whole study set, so questions about it get the best answers.