Workplace data: identify rows, connect tables and group changes
When customer and order tables are connected, how should identical names or customers with no orders be handled? Database terms help make those business conditions explicit. Start with row identity, then matching related rows, and finally grouping changes that must succeed together.
The guide introduces relational databases and standard SQL. Some details, including null handling, vary across products and configurations, so read the examples' premises. Displaying a table and correctly representing its customers or transactions are separate achievements.
This opens the setup screen with this subject and topic selected. Check the mode and question count before you start.
Identify a row without relying on its display name
A customer row groups information about one customer; its columns hold item types such as an address. A standard SQL primary key uniquely identifies a row and has non-null values. Shared names and name changes illustrate why a person's name alone is often a poor identifier.
A stable customer ID referenced by orders separates display-name changes from identity. Repeating the same fact manually across many rows can create contradictions after partial updates. Deciding which table owns which subject's facts provides a foundation for reliable relationships.
Decide what survives a join
An INNER JOIN returns matching row combinations. Joining customers to orders this way leaves customers with no orders out of the result. A LEFT JOIN preserves the left-side customers and supplies nulls in the right-side columns when an order match is absent.
Do not silently treat a null as zero sales or an empty string. How an absent match should be reported depends on the query's purpose. Joins can also expand row counts, so the number of result rows need not equal the number of customers originally selected.
Make related updates one unit of completion
Recording a transfer can involve reducing one balance and increasing another. Transaction atomicity makes grouped changes all-or-nothing. It prevents the intended operation from taking effect only in part, such as recording one side of a transfer without the other.
COMMIT finalizes a transaction; ROLLBACK cancels uncommitted changes. Completion, visibility to other work and recovery after media loss concern different guarantees. One success message should not be treated as evidence that every possible requirement has been met.
TRY & READ
Check your understanding with examples
Compare the choices before opening the answer and explanation. Reading an example does not save a test answer or score.
Example 1 · Workplace data and databases
What are basic requirements of a primary key in a standard SQL table?
Have the same value in every row
Always be only the customer's name
Always be only a sum of numbers
Uniquely identify each row and contain no nulls
Read the answer and explanation
Answer: Uniquely identify each row and contain no nulls
A primary key combines uniqueness with non-null values.
Topics: Workplace data and databases. Range: Everyday knowledge, Broader knowledge, General knowledge. Difficulty: Basic, Standard. These are selected initially. You can change these on the setup screen.
A test shows explanations after submission. Continuous challenge explains each answer. Review uses unresolved mistakes recorded on this device. Casual mode does not update learning records.