SQL and Database Fundamentals
- 114Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
114 questions
- 1The language used to retrieve and manage data in relational databases, and a common standard across applications, is_____.
Hint
It is the language at the center of the database concepts in this material.
Answer
SQL
- 2In a basic retrieval query, the SELECT statement specifies the data or_____to return.
Hint
These are the named pieces of information stored in a table.
Answer
columns
- 3In a basic retrieval query, the FROM clause identifies the_____that contains the requested data.
Hint
It is the database structure from which rows are retrieved.
Answer
table
- 4In a SELECT list, the asterisk is shorthand for retrieving_____columns.
Hint
It requests every column in the selected table.
Answer
all
- 5In production queries, explicitly listing needed columns instead of using an asterisk can reduce unnecessary data retrieval and_____load.
Hint
This refers to the database's reading and writing workload.
Answer
IO
- 6The clause that filters individual rows according to conditions is_____.
Hint
It keeps rows that satisfy a specified condition.
Answer
WHERE
- 7SQL comparison operators can compare numbers, dates, and text, including testing whether a value is greater than or_____a specified value.
Hint
It is the opposite direction from greater than.
Answer
less than
- 8The LIKE operator searches text for a pattern, and the percent sign wildcard matches any sequence of characters, including_____characters.
Hint
A pattern can match an empty sequence as well as a longer one.
Answer
no
- 9To require that both a product's category and color conditions are true, combine them with the logical operator_____.
Hint
This operator narrows results by requiring every joined condition to be true.
Answer
AND
- 10To include rows that satisfy either one condition or another, use the logical operator_____.
Hint
Unlike AND, this operator can broaden the results.
Answer
OR
- 11When AND and OR appear together, parentheses clarify the intended grouping because_____has higher precedence by default.
Hint
SQL evaluates this operator before OR unless parentheses change the order.
Answer
AND
- 12The logical operator that reverses the truth of a condition is_____.
Hint
It turns a condition into its opposite.
Answer
NOT
- 13The SELECT keyword that removes duplicate result rows and returns unique values is_____.
Hint
It is useful when a report needs a list of manufacturers rather than every sale.
Answer
DISTINCT
- 14When DISTINCT is applied to multiple selected columns, it identifies unique_____of values across those columns.
Hint
For example, a manufacturer and color together form a single unit for comparison.
Answer
combinations
- 15The clause that sorts query results without changing which data is returned is_____.
Hint
It controls the sequence in which results are presented.
Answer
ORDER BY
- 16Unless specified otherwise, ORDER BY sorts in_____order, such as A to Z for text and smallest to largest for numbers.
Hint
This is the default direction of sorting.
Answer
ascending
- 17To show the most expensive products first, a query can sort price in_____order.
Hint
This sorting direction runs from largest to smallest.
Answer
descending
- 18When ORDER BY lists category before price, SQL sorts by category first and then sorts prices within each category; this is sorting by_____columns.
Hint
More than one field can determine the order.
Answer
multiple
- 19SQL can turn raw sales records into business insights used for decisions such as inventory planning and detecting potential_____.
Hint
This is an example of an unusual pattern businesses may want to identify.
Answer
fraud
- 20The clause that divides rows into groups based on shared values in one or more columns is_____.
Hint
It makes it possible to calculate totals separately for categories or brands.
Answer
GROUP BY
- 21The aggregate function that counts the number of rows in each group is_____.
Hint
It answers questions such as how many products a brand supplies.
Answer
COUNT
- 22To calculate total revenue or add values in a numeric column within each group, use the aggregate function_____.
Hint
It adds the group's numeric values together.
Answer
SUM
- 23The aggregate function that calculates the mean of a numeric column within each group is_____.
Hint
It produces the arithmetic average.
Answer
AVG
- 24To find the smallest value in a group, use the aggregate function_____.
Hint
It returns the minimum value.
Answer
MIN
- 25To find the largest value in a group, use the aggregate function_____.
Hint
It returns the maximum value.
Answer
MAX
- 26To calculate revenue for each product category, group rows by category and apply SUM to the product of price and quantity; an output label such as total revenue is an_____.
Hint
It gives a calculated output column a readable name.
Answer
alias
- 27The clause that filters groups after GROUP BY and aggregation is_____.
Hint
It can select categories whose aggregated revenue exceeds a threshold.
Answer
HAVING
- 28A query cannot use WHERE to filter on a result such as SUM because WHERE runs before_____.
Hint
This step forms groups for aggregate calculations.
Answer
GROUP BY
- 29Putting customer, product, manufacturer, and sale information into one large table can cause repeated data, a problem called_____.
Hint
For example, the same customer address could be stored with every purchase.
Answer
redundancy
- 30The design process of organizing data into related tables to reduce repetition and improve consistency is_____.
Hint
It separates information about entities such as customers, products, and sales.
Answer
normalization
- 31In a normalized design, each table generally focuses on one specific_____or subject, such as a customer or product.
Hint
It is the kind of thing about which a table stores information.
Answer
entity
- 32A primary key identifies each row in its table with a_____value.
Hint
No two rows in the table should share this identifying value.
Answer
unique
- 33A foreign key in one table contains a value that refers to the_____key in another table.
Hint
This is the unique identifier in the referenced table.
Answer
primary
- 34A sale record can refer to a customer's full record using a customer ID rather than repeating the customer's name and address; this link uses a_____key.
Hint
It connects a row to a key in another table.
Answer
foreign
- 35The most common join, which returns rows only when the join condition matches in both tables, is an_____join.
Hint
It returns the overlapping matches between the two tables.
Answer
INNER
- 36With an INNER JOIN between sales and products, a product that has never been sold is excluded because it has no_____row in the sales table.
Hint
The required link between the tables is absent for this product.
Answer
matching
- 37In an explicit join, the ON clause specifies the_____that tells the database how the tables are related.
Hint
It commonly matches a foreign key to a primary key.
Answer
join condition
- 38When a query joins several tables, listing only needed columns with their table names or aliases makes the query clearer and avoids_____columns.
Hint
These columns are not needed for the requested result.
Answer
unnecessary
- 39To retrieve sale, product, and manufacturer details, a query can follow their relationships by chaining_____together.
Hint
Each step links another related table into the query.
Answer
joins
- 40A temporary nickname such as S for the sale table, used to shorten references within a query, is a table_____.
Hint
It makes references to long table names more concise.
Answer
alias
- 41A LEFT JOIN retains every row from the table listed first and fills unmatched columns from the other table with_____values.
Hint
These values indicate missing or unknown data in the unmatched side.
Answer
NULL
- 42A RIGHT JOIN retains every row from the_____table in the join and fills unmatched columns from the other table with NULL values.
Hint
It keeps all rows from the table on the opposite side from a LEFT JOIN.
Answer
right
- 43A FULL OUTER JOIN keeps all rows from_____tables, using NULL values where a row has no match on the other side.
Hint
It combines the unmatched-row behavior of left and right joins.
Answer
both
- 44If a join condition is missing or incorrect, every row from one table may combine with every row from the other, producing a_____product.
Hint
This can cause an unexpectedly enormous result set.
Answer
Cartesian
- 45A NATURAL JOIN guesses which columns to match by looking for shared column names, so explicit joins are often preferred because they are more_____.
Hint
The query directly states the intended relationship instead of guessing.
Answer
explicit
- 46The data manipulation language command used to add new rows to a table is_____.
Hint
It places new records into an existing table.
Answer
INSERT
- 47When inserting data, explicitly naming the destination columns makes it clear which value corresponds to which_____.
Hint
The listed values must match these named fields.
Answer
column
- 48Explicitly listing INSERT columns also makes a statement more resilient if a new column is later added to the table, because it avoids relying on the table's default column_____.
Hint
Without a column list, values may depend on how fields are arranged.
Answer
order
- 49If an INSERT omits a column that has a defined default, the database assigns the column's_____value.
Hint
It is the value configured for use when no value is supplied.
Answer
default
- 50If an omitted column has no defined default, it will typically receive the value_____.
Hint
This represents a missing, unknown, or inapplicable value rather than zero.
Answer
NULL
- 51INSERT can copy selected rows from one table into another by using a SELECT statement, which is useful for tasks such as archiving old_____.
Hint
These records represent completed transactions that might be moved to an archive.
Answer
sales
- 52When a new sale references a customer ID that does not exist in the customer table, the database should reject the INSERT to preserve_____integrity.
Hint
This protects the validity of relationships between linked tables.
Answer
referential
- 53The database rejects an INSERT that tries to reuse an existing value for a row's_____key.
Hint
This key must uniquely identify each row.
Answer
primary
- 54The SQL statement for modifying existing rows uses SET to assign new values and a_____clause to identify which rows should change.
Hint
It restricts the update to records that meet a condition.
Answer
WHERE
- 55An UPDATE statement without a WHERE clause changes_____rows in the table.
Hint
No condition restricts which records are affected.
Answer
every
- 56Before running a potentially risky UPDATE, use a SELECT query with the same WHERE condition to_____the rows that would be affected.
Hint
This safety step lets you inspect the target records first.
Answer
preview
- 57The exact syntax for updating rows in multiple tables can vary across database_____.
Hint
Different products may support different forms of multi-table updates.
Answer
systems
- 58The SQL statement used to remove selected rows from a table is_____.
Hint
It removes records while leaving the table structure in place.
Answer
DELETE
- 59A DELETE statement without a WHERE clause removes_____rows from the table.
Hint
Without a condition, no records are excluded from the operation.
Answer
all
- 60Before running a DELETE, a SELECT with the same WHERE condition helps verify which records are about to be_____.
Hint
The query is a preview of the destructive operation.
Answer
deleted
- 61The foreign-key behavior that blocks deleting a parent row while dependent child rows still exist is called_____.
Hint
It is the protective behavior that prevents the deletion.
Answer
RESTRICT
- 62With the CASCADE foreign-key behavior, deleting a parent record automatically deletes its related_____records.
Hint
These are the dependent rows that refer to the parent.
Answer
child
- 63With the SET NULL foreign-key behavior, deleting a parent sets the corresponding foreign-key value in child rows to_____.
Hint
The child row remains, but its link to the deleted parent is cleared.
Answer
NULL
- 64A soft delete preserves a record physically but marks it as inactive or records a deletion date so normal application views can filter it_____.
Hint
The record remains available for auditing or reporting but is excluded from ordinary views.
Answer
out
- 65DROP TABLE removes the table's structure as well as its_____.
Hint
Unlike DELETE, it removes more than just the rows.
Answer
data
- 66Before dropping a significant table, one essential safeguard is to make a reliable, recent_____.
Hint
It can help recover data if the operation causes a problem.
Answer
backup
- 67Before dropping a table, checking which other tables, views, or procedures rely on it means checking its_____.
Hint
These are the database objects that may rely on the table.
Answer
dependencies
- 68Testing a DROP TABLE script in a development or staging environment before production is an example of testing in a_____environment.
Hint
It is separate from the live environment used for real operations.
Answer
non-production
- 69Adding IF EXISTS to a DROP TABLE script prevents an error if the table has already been removed or_____.
Hint
The clause handles the case where there is no such table to drop.
Answer
never existed
- 70If a child table has a foreign key referencing a parent table, the child table generally must be dropped_____the parent table.
Hint
Remove the dependent object first to avoid a dependency error.
Answer
before
- 71A sensible order for writing SQL is correctness first, readability second, and_____third.
Hint
This priority focuses on making a correct, understandable query faster only when needed.
Answer
optimization
- 72Adding comments that explain why complex query logic exists improves long-term code_____.
Hint
Comments help teammates understand and maintain a query.
Answer
readability
- 73When joining several tables, using table aliases consistently can make references shorter and more_____.
Hint
Aliases reduce clutter in complex queries.
Answer
readable
- 74Using explicit JOIN ... ON syntax rather than placing join conditions in WHERE separates table-linking logic from row_____logic.
Hint
This logic is commonly expressed with the WHERE clause.
Answer
filtering
- 75Putting selected columns and conditions on separate, consistently formatted lines helps make query_____visible.
Hint
Consistent formatting helps readers see how the query is organized.
Answer
structure
- 76In the conceptual SQL processing order, FROM and JOIN identify the initial set of candidate rows before WHERE filters them and GROUP BY forms_____.
Hint
These are collections of rows with shared values.
Answer
groups
- 77In the conceptual query processing order, HAVING filters groups before SELECT chooses output columns and ORDER BY_____the final results.
Hint
This last step controls the sequence in which rows are presented.
Answer
sorts
- 78Reducing unwanted rows early, such as with WHERE before GROUP BY, can improve performance by minimizing the database's search_____.
Hint
Fewer rows need to be carried through later operations.
Answer
space
- 79An index helps a database find rows without reading every row in a table, avoiding a full table_____when the index can be used.
Hint
Without an index, the database may have to inspect the entire table.
Answer
scan
- 80A database index stores indexed values in a structured order along with_____back to the corresponding table rows.
Hint
These lead from an index entry to the actual record.
Answer
pointers
- 81Indexes can speed up SELECT operations but slow INSERT, UPDATE, and DELETE operations because the database must keep the index structures_____when data changes.
Hint
The lookup structure must stay consistent with its table.
Answer
updated
- 82Strategic indexing often focuses on columns frequently used in WHERE conditions, JOIN conditions, or sometimes_____clauses.
Hint
This clause sorts results using specified columns.
Answer
ORDER BY
- 83A query condition is called sargable when it is written so the database can use an_____to find matching rows.
Hint
This lookup structure can avoid a full table scan.
Answer
index
- 84Applying a function directly to an indexed column in a WHERE condition can make the condition non-sargable because the database may need to evaluate the function for every_____.
Hint
Each record's column value may have to be transformed before comparison.
Answer
row
- 85For a date-range search, leaving the indexed date column unmodified and comparing it to range boundaries can allow the database to use its_____.
Hint
This is preferable to applying a year-extraction function to every date.
Answer
index
- 86A LIKE pattern with a leading percent sign, such as a search for text anywhere inside a name, usually prevents efficient_____use.
Hint
The database cannot readily use the beginning of the indexed text to locate an arbitrary substring.
Answer
index
- 87When testing for exact text equality, prefer an exact-match comparison over LIKE when possible, since it may be more efficient and_____.
Hint
The comparison should express exactly the condition needed.
Answer
precise
- 88When a subquery returns many rows, EXISTS may perform well because it checks whether a match is present and can stop after finding_____.
Hint
It does not need to enumerate every matching result to answer its existence question.
Answer
one
- 89To reduce join work, include only tables needed for selected data or filtering, and apply applicable filters to each table_____the join when possible.
Hint
Reducing input rows can make the join operation smaller.
Answer
before
- 90If nonmatching rows are not needed, an INNER JOIN is often faster than an outer join because the database does not need to preserve unmatched rows or generate their_____values.
Hint
These values appear in the missing side of an outer-join result.
Answer
NULL
- 91A query using a join can often avoid the repeated per-row work of a correlated_____.
Hint
This inner query refers back to a row in the outer query.
Answer
subquery
- 92In application code, fetching a list and then issuing a separate query for each item's details creates the_____query problem.
Hint
One query retrieves the list, followed by one additional query per item.
Answer
N plus one
- 93UNION removes duplicate rows from combined results, whereas UNION ALL preserves them and is often faster because it avoids duplicate_____.
Hint
This extra work may involve identifying repeated rows.
Answer
removal
- 94To investigate why a query is slow, a developer can use EXPLAIN or a similar tool to inspect its execution_____.
Hint
It describes the operations the database intends to perform.
Answer
plan
- 95An execution plan can show whether a query uses indexes or performs table scans, the join algorithms, row estimates, and operation_____or time.
Hint
These estimates help identify expensive steps.
Answer
cost
- 96A common table expression, defined with the WITH keyword, is a named temporary result set that exists for a single_____.
Hint
It can be referenced later in the statement that defines it.
Answer
query
- 97Using CTEs to define logical steps can make long, multi-step queries more_____and maintainable than deeply nested subqueries.
Hint
Named steps help a reader follow the query's structure.
Answer
readable
- 98Strategic denormalization intentionally adds controlled_____to reduce expensive joins in read-heavy applications.
Hint
It reintroduces some repeated data for a performance benefit.
Answer
redundancy
- 99Partitioning divides a very large table into smaller chunks based on a criterion such as_____ranges.
Hint
A table might have a separate partition for each month.
Answer
date
- 100SQL scripts should be tested in a dedicated development, staging, or test environment and never directly on a_____database.
Hint
This is the live environment containing real operational data.
Answer
production
- 101A repeatable database test often begins by creating the required table structures, also called the_____.
Hint
It describes the database's tables and their structure.
Answer
schema
- 102After creating test tables, a repeatable test loads a small, specific set of_____relevant to the test case.
Hint
These sample records provide a known input for the test.
Answer
test data
- 103After running the SQL being tested, verification queries check whether the database is in the expected_____.
Hint
The test checks the resulting data and structure against expectations.
Answer
state
- 104Cleaning up test tables by truncating or dropping them is called_____and helps the next test start fresh.
Hint
It is the cleanup phase at the end of a test.
Answer
tearing down
- 105After starting a transaction, a tester can inspect uncommitted changes and make them permanent with_____.
Hint
This transaction command finalizes the changes.
Answer
COMMIT
- 106If a transaction's changes are unwanted, the tester can use_____to undo changes made since the transaction began.
Hint
It restores the database to its state before the transaction.
Answer
ROLLBACK
- 107Containers such as Docker and in-memory databases such as SQLite can provide isolated database instances for_____.
Hint
These tools offer controlled environments separate from production.
Answer
testing
- 108A direct modification of production data should generally be a_____event requiring approval and strong justification.
Hint
Organizations should not treat these changes as routine or casual.
Answer
rare
- 109Correcting a clear factual error can support data accuracy, while changing historical records to misrepresent results is data_____.
Hint
This describes changes made to distort rather than accurately correct the record.
Answer
manipulation
- 110An audit trail records who made a change, what was changed, when it occurred, and_____it was made.
Hint
A change log may link this reason to a support ticket or bug report.
Answer
why
- 111To show what changed, an audit log may record the table, column, primary key, and the old and new_____.
Hint
They are the contents of the affected field before and after the change.
Answer
values
- 112Recording the user account or automated process that made a change answers the audit-trail question of_____.
Hint
It identifies the actor responsible for the change.
Answer
who
- 113An audit trail records_____a change occurred by capturing a precise timestamp.
Hint
This audit detail places the change in time.
Answer
when
- 114Transparent, traceable changes help maintain data integrity, accountability, and trust in the data's_____.
Hint
Auditors need to be able to verify how records changed over time.
Answer
history

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