Learn SQL
What Is a Database Table? Rows, Columns, and the Mental Model Behind SQL
Before SQL feels natural, you need one simple mental model: tables are structured collections of records with predictable columns.
On This Page
Start with the shape of data
Most people start learning SQL by memorizing SELECT statements. That works for a few minutes, but it misses the deeper idea: SQL is a language for asking questions about structured data. Before the syntax matters, the shape matters.
SQL for Files is built to make that first step practical. You can open the app in your browser, load CSV, JSON, or Parquet files, and query them with SQL locally using DuckDB WASM. The Learn SQL lessons give you small, guided examples before you bring in your own files.
No server required
SQL for Files runs file import and query execution in the browser, so your practice data and query results stay on your device.
A table is the spreadsheet idea with stronger rules
If you have ever opened a spreadsheet, you already know the basic picture. Data sits in a grid. Columns run vertically. Rows run horizontally. A database table uses the same visual idea, but with more consistency and clearer expectations.
- Each column describes one property, such as name, department, salary, or hire date.
- Each row represents one record, such as one employee, one order, or one measurement.
- Every row follows the same structure, so SQL can ask reliable questions across the whole table.
id | name | department | salary
---|---------|-------------|-------
1 | Alice | Engineering | 95000
2 | Bob | Marketing | 72000
3 | Charlie | Engineering | 110000Rows are records; columns are properties
The fastest way to understand a table is to read it in two directions. Across a row, you see a complete record. Down a column, you see the same property repeated for many records. SQL becomes powerful because it can move in both directions without manual copying, filtering, or scrolling.
For example, one employee row might contain an ID, a name, a department, a salary, and a hire date. The salary column, read downward, lets you ask questions like who earns the most, what the average salary is, or which departments have higher payroll costs.
Why structure matters before your first query
SQL depends on predictable structure. When a table has a salary column, SQL can calculate averages. When it has a hire_date column, SQL can sort by tenure or filter a date range. When every row follows the same shape, a single query can inspect thousands or millions of records at once.
- A clear table shape makes queries easier to write.
- Consistent columns make results easier to trust.
- Structured records let you move from manual inspection to repeatable analysis.
Try the matching Learn SQL lesson
The first Learn SQL lesson in SQL for Files focuses on this foundation: tables, rows, and columns. It is intentionally simple because it gives every later SQL topic a place to land.
- Open the related lesson from the cards at the bottom of this article.
- Read the short explanation of table structure.
- Then continue to the next lesson on data types before writing your first SELECT query.
Continue in the editor
Open SQL for Files to add your own CSV, JSON, or Parquet files and try these examples locally in your browser.
Open editorRelated Learn SQL lessons
Related guides
SQL Data Types Explained: Text, Numbers, Dates, and Better Questions
Data types are the reason SQL knows the difference between a name, a salary, and a hire date — and that difference shapes every query you write.
SQL NULL Explained: How Missing Values Work and Why They Matter
NULL is SQL's way of saying a value is missing or unknown — and it behaves differently from almost every other value beginners expect.
How to Query CSV Files with SQL in Your Browser
Use SQL for Files as a local CSV analysis workspace: add a file, inspect the generated table, write SQL, and export the rows you need.