Skip to content
/Chapter 1 · Welcome to the Shed
Lesson 1.3·garden_shop
Lesson 1.3

Tables, Rows, and Columns in SQL

Tables organize data into columns, and each row is one record.

A table has a name, like customers. Columns describe the fields available in that table, like first_name or state.

Rows are the records inside the table. In the Garden Shop dataset, each row in customers represents one customer.

Read a table before querying it

Before writing a report query, inspect the table name, the column names, and a few sample rows. That quick scan tells you what each row represents, which columns are identifiers, and which columns are useful for filtering, sorting, or grouping.

Pattern
select count(*) as row_count
from table_name
Schema · Garden ShopTable · customers9 columns · 20 rows
Table · customers

One row per customer. Some customers have no phone on file.

9 columns · 20 rows
customer_id intfirst_name textlast_name textemail textphone textcity textstate textsignup_date dateis_active bool
Your task

Count how many rows are in the customers table. Name the output column customer_count.

SQL Workbench
query.sqlgarden_shop · SQL engine loading
⌘↵ to run
·
Expected answer
  • Columns: customer_count.
  • Rows: 1 summary row.
  • The customer_count value should be 20.