Tables and keys
A relation is rows with named columns. A primary key uniquely identifies each row. A foreign key references a parent key to enforce referential integrity.
Study guide · Core notes
Reference notes for Oracle exam 1Z0-171. Each section names the object, and what you check in an Oracle schema you are allowed to drop.
How to read these notes: Unmarked items sit on the public 1Z0-171 topic list or the SQL Language Reference they point at. Items tagged Extra are job context that outline does not require. New to the exam? Start with the overview. Practice in a schema you can remove. Weights below are the official percentages.
5% editorial study emphasis. Keys, relations, normalization.
A relation is rows with named columns. A primary key uniquely identifies each row. A foreign key references a parent key to enforce referential integrity.
Separate repeating groups to reduce redundant updates. Store mutable facts once and join when you need them.
Entity integrity (primary keys) and referential integrity (foreign keys) are the relational guarantees this exam expects you to name.
This topic is conceptual. Deep physical storage and RAC design are out of associate SQL depth. Extra Production modeling also considers indexing and partitioning trade-offs.
15% editorial study emphasis. Projection, filters, sorts.
Choose columns or expressions. Aliases label output and can appear in ORDER BY. DISTINCT removes duplicate result rows.
Filters rows before grouping. Use IS NULL / IS NOT NULL—not = NULL. BETWEEN is inclusive. IN tests membership.
% matches any length; _ matches one character. Use ESCAPE when you need a literal underscore or percent.
Sorts the final result. ASC/DESC combine with NULLS FIRST/LAST. AND binds tighter than OR—use parentheses.
25% editorial study emphasis. Heaviest topic—drill daily.
NVL substitutes a value for null. NVL2 picks based on nullness of the first argument. NULLIF returns null when two values are equal. COALESCE returns the first non-null argument.
TO_CHAR, TO_DATE, and TO_NUMBER need format models that match the string and session NLS. Mismatched separators raise invalid number/date errors.
UPPER, LOWER, SUBSTR, INSTR, LENGTH, ROUND, TRUNC, GREATEST/LEAST, NEXT_DAY, ADD_MONTHS, MONTHS_BETWEEN.
AVG, SUM, MIN, MAX, and COUNT aggregate rows. COUNT(*) counts rows; COUNT(expr) skips null expr. Mix with non-aggregates only via GROUP BY (or analytics).
10% editorial study emphasis. Join types and pitfalls.
INNER JOIN keeps matches. LEFT/RIGHT OUTER JOIN preserves one side. FULL OUTER JOIN preserves both. Missing join predicates create Cartesian products.
Older equijoin syntax uses (+) on the deficient side. Prefer ANSI JOIN in new SQL, but recognize (+) on the exam.
Alias the same table twice for hierarchies such as employee/manager.
Filtering the optional table in WHERE can turn an outer join into an effective inner join. Keep optional-side predicates in ON when you need null-extended rows.
5% editorial study emphasis. Nested queries.
Subqueries appear in WHERE, HAVING, FROM (inline views), and the SELECT list among other places.
=, <, > need single-row subqueries. Multi-row results need IN, ANY, or ALL.
A correlated subquery references outer columns and may run once per candidate outer row.
A NULL in a NOT IN subquery can cause the predicate to return no rows. IN can still match a non-null value; filter NULLs deliberately or use a suitable EXISTS pattern.
5% editorial study emphasis. UNION family and MINUS.
UNION returns distinct rows from both queries. UNION ALL keeps duplicates and skips the distinct work.
INTERSECT returns common distinct rows. MINUS returns rows in the first query not in the second. The Oracle checklist names MINUS; current Oracle SQL also accepts EXCEPT as a synonym.
Corresponding expressions must match in count and compatible types. ORDER BY belongs at the end of the compound statement.
Auditing and staging loads often want UNION ALL so duplicate rows survive.
5% editorial study emphasis. Row changes.
INSERT adds rows. UPDATE changes matching rows. DELETE removes matching rows without dropping the table.
MERGE conditionally inserts or updates (and can delete) based on a USING source and ON match.
Foreign keys can block parent key changes that would orphan children. ON DELETE CASCADE applies to parent deletes, not key updates.
DML is transactional. COMMIT and ROLLBACK control durability. Extra Know your client’s autocommit setting in tools.
5% editorial study emphasis. Supporting schema objects.
Speed selective filters and joins. They add write and storage cost. Useless if the column is never used.
NEXTVAL advances and returns the next number; CURRVAL returns the current value after NEXTVAL in the session. Common for surrogate keys.
Private synonyms alias objects for the owner. Public synonyms are visible more broadly—watch name resolution surprises.
Unqualified names can bind to a local object or a synonym depending on resolution rules. Qualify schema.object when clarity matters.
15% editorial study emphasis. Structure and constraints.
CREATE TABLE defines structure. ALTER TABLE adds columns and constraints. DROP TABLE removes the object. TRUNCATE empties rows quickly while keeping the table.
PRIMARY KEY, UNIQUE, NOT NULL, CHECK, and FOREIGN KEY enforce integrity. ON DELETE CASCADE removes children when parents go.
A view is a stored query. It can hide columns and simplify SQL. Not every join view is updatable.
CREATE TABLE AS SELECT builds and loads a table from a query. Constraints and indexes are not all copied automatically.
5% editorial study emphasis. Privileges and roles.
GRANT confers system or object privileges. REVOKE removes them. SELECT on a table does not imply DROP USER.
Roles group privileges for easier least-privilege administration. Grant roles to users instead of repeating direct grants.
Common object privileges include SELECT, INSERT, UPDATE, DELETE, and REFERENCES on specific objects.
Application accounts get only required statements on required objects. Prefer roles over sprawling direct grants.
5% editorial study emphasis. Metadata and datetime.
USER_ shows what you own. ALL_ adds accessible objects. DBA_ is database-wide and privileged.
USER_TABLES, USER_CONSTRAINTS, USER_INDEXES, and USER_OBJECTS answer “what exists in my schema?”
CURRENT_DATE is DATE in the session time zone. CURRENT_TIMESTAMP is TIMESTAMP WITH TIME ZONE. LOCALTIMESTAMP is TIMESTAMP without time zone in the session TZ.
INTERVAL DAY TO SECOND (and YEAR TO MONTH) store durations for datetime arithmetic—not calendar points.
Use a disposable schema and tiny tables so you can calculate the expected result by hand. The purpose of these examples is to distinguish a valid statement from a statement that answers the intended question.
Assume departments 10 and 20 exist, but only department 10 has employees. A LEFT JOIN from departments to employees preserves both departments. If you then put WHERE e.active = 'Y' after the join, the null-extended row for department 20 does not satisfy the filter. If the requirement is to list every department and count only active employees, put that employee condition in the join condition and count a non-null employee key.
SELECT d.id, COUNT(e.id) AS active_employees
FROM departments d
LEFT JOIN employees e
ON e.department_id = d.id AND e.active = 'Y'
GROUP BY d.id;
COUNT(*) would count the preserved row even where no employee matched. COUNT(e.id) gives zero for that case when the employee key is non-null for real employees. Add a second employee and verify that the count changes without removing the empty department. This small dataset tests both cardinality and the treatment of missing matches.
Suppose a subquery returns the values 10 and NULL. Asking whether 20 is NOT IN that result does not produce a simple true result: comparison with the null introduces unknown. A WHERE clause retains true predicates, so the row may disappear unexpectedly. If the business question is “there is no matching department assignment,” a correlated NOT EXISTS often expresses the intent more directly. Check the treatment of null keys in the outer table as well; two formulations are not interchangeable unless their null semantics match the requirement.
Do not replace missing data with an arbitrary sentinel merely to force a comparison. A sentinel can collide with a valid value or change the meaning of “unknown.” State whether the application allows nulls, whether constraints enforce that rule, and what the report should display when the data is incomplete.
In Oracle, issuing syntactically valid DDL can commit preceding transaction work before the DDL executes, even if that DDL later fails. Successful DDL is followed by an implicit commit as well. This differs from treating every statement as one freely reversible script. In a lab, update a test row, issue a DDL statement, then attempt a rollback and inspect the result. Keep schema changes separate from an application transaction whose earlier DML you expect to undo.
A savepoint is useful within its valid transaction boundary, but it does not survive a commit. Sequence values also should not be treated as a gap-free count of committed business records. Generate identifiers for uniqueness, and design any separate business numbering requirement explicitly. Inferring a missing sale from a gap in a sequence is not justified.
A text value such as “03/04/2026” is ambiguous without a format convention. Use an explicit format model when converting text, or an appropriate typed date literal for a known constant. For timestamped data, define which timezone determines the business day. Filtering “today” in one session timezone while reporting another timezone can move records across boundaries.
Finally, specify ORDER BY whenever the result needs a defined order. If several rows share the same sort value and the application requires stable pagination, add a deterministic tie-breaker such as a unique key. An index or a previous execution's row order does not promise the next result order.
Technical reference: Oracle SQL COMMIT and implicit DDL commits. Use the existing SQL language references above to test the independent query examples.
Say what you expect to see before you change the data. Then drop the objects if they were only for practice.
Select rows where commission IS NULL and contrast with commission = NULL.
What to verify: IS NULL returns the null-commission rows; equality to NULL returns none.
TO_DATE a string with an explicit model, then TO_CHAR it back with Day and a trimmed comparison.
What to verify: conversion succeeds with matching models, and blank-padded Day does not break equality after FM/trim.
Count employees per department including departments with zero employees.
What to verify: departments without employees appear with count 0, not disappear as with INNER JOIN.
Build two compatible queries and MINUS the second from the first; repeat with UNION ALL.
What to verify: MINUS drops overlaps; UNION ALL keeps duplicates that UNION would remove.
MERGE a staging row into a target on primary key, updating when matched and inserting when not.
What to verify: one statement covers both paths; a second run updates instead of duplicating the key.
Create a sequence and insert with sequence.NEXTVAL as the surrogate key.
What to verify: NEXTVAL advances; CURRVAL matches the value just taken in the same session.
Create parent/child tables with ON DELETE CASCADE and delete a parent.
What to verify: child rows disappear with the parent; without CASCADE the delete fails when children exist.
Query USER_CONSTRAINTS for your table and select CURRENT_DATE, CURRENT_TIMESTAMP, and LOCALTIMESTAMP.
What to verify: the constraint row appears under USER_, and the three datetime expressions return the expected types/forms.
These notes follow Oracle AI Database SQL Associate exam 1Z0-171 and its eleven published topic areas. Percentages shown here are Certicab’s practice allocation, not Oracle exam weights. This is not 1Z0-071 Oracle Database SQL. Passing either exam does not award the other.
MINUS. Oracle’s checklist names MINUS for set difference; current Oracle SQL also supports EXCEPT as a synonym. UNION removes duplicates across both queries; UNION ALL keeps duplicates.
NVL(expr1, expr2) returns expr2 when expr1 is null. NULLIF(a, b) returns null when a equals b; otherwise it returns a. COALESCE returns the first non-null argument.
USER_ views show objects you own. ALL_ views add objects you can access. DBA_ views show database-wide metadata and require privileged access.
The overview, core notes, flashcards, and practice exams are all published.
Exam format, the eleven topic areas, and a lab plan.
Reference notes for SELECT, functions, joins, DDL, and privileges.
48 recall cards in eleven decks across the topic areas.
200 original questions across the eleven topic areas.
Notes follow the Oracle Japan 1Z0-171 exam listing, the 1Z0-071 contrast page, the Oracle certification catalog, and the Oracle Database documentation (SQL Language Reference).
Oracle MySQL Implementation Associate (1Z0-922). Passing either exam does not award the other.
DP-900 covers data concepts on Azure. It is not an Oracle SQL certification.
A Google Cloud database exam. Passing either exam does not award the other.
Compare document database development with Oracle SQL associate concepts.
Certicab provides general informational, educational, and convenience resources. Learning materials can contain errors or become outdated. Check the current exam guide and official documentation before relying on a technical recommendation. Practice only in environments you own or are authorized to use, and do not share credentials or confidential exam material. Study resources are independent and do not guarantee exam success or imply certification-provider endorsement. Oracle and Java are trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. Certicab is not affiliated with, endorsed by, or sponsored by Oracle.