SQL Flow Field Guide

Name a row's grain and key

Describe the row grain and distinguish sample uniqueness from an enforced key.

What you are trying to do

A team directory preview has one row per staff member. Two people can belong to the same team, and a reviewer must say what the sample does and does not guarantee.

Work through it

  1. Read the inline staff rows and compare StaffId with Team.
  2. Name the entity represented by one result row.
  3. Separate the observed values from a key constraint declared in a table definition.

Check your work

Three rows appear, one per staff member. StaffId is distinct in this sample and Team repeats. The VALUES query does not enforce a key for future data.

Practice SQL

Open in SQL Flow
SELECT StaffId, Team
FROM (VALUES (101, N'Care'), (102, N'Care'), (103, N'Ops')) AS Staff(StaffId, Team)
ORDER BY StaffId;

Knowledge check

Commands in this lesson

Next lesson Match rows with an inner join