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.
select count(*) as row_count
from table_nameSchema · Garden ShopTable · customers9 columns · 20 rows
One row per customer. Some customers have no phone on file.
Count how many rows are in the customers table. Name the output column customer_count.
- Columns: customer_count.
- Rows: 1 summary row.
- The customer_count value should be 20.
Related
Understand tables, rows, columns, and queries.
Run queries and read results in the browser.
Write a first SELECT and read the returned rows.
Scout table sizes before writing larger reports.