Tables aren't spreadsheets
Name a table's parts, and see three ways a table differs from a sheet.
2 parts · 5 and 3 min
Sample page. Your Maestro, an AI, answers your free questions about this page.
Now that you can separate the database from the DBMS that manages it and the client where you send commands, let's look inside the database itself. In a relational database, your data live in tables. People often assume "relational" just means several tables linked together, but the word comes from relation—the mathematical term for a table itself. Even a single table on its own is a relation.
When you run SELECT * FROM customers; in DuckDB, the result prints as a grid that looks a lot like a spreadsheet tab:
SELECT * FROM customers;customer_id | name | city | email | signup_date------------+--------------+---------+---------------------+------------1 | Ana Torres | Austin | ana@example.com | 2024-01-152 | Sam Lee | Denver | sam.lee@example.com | 2024-02-033 | Priya Shah | Austin | priya@example.com | 2024-02-204 | Sam Lee | Chicago | NULL | 2024-03-115 | Marcus Bell | Denver | | 2024-03-286 | Julia Kim | NULL | julia@example.com | 2024-04-097 | Diego Ramos | Chicago | diego@example.com | 2024-04-228 | Hana Sato | Austin | hana@example.com | 2024-05-069 | Leo Martin | Denver | leo@example.com | 2024-05-1910 | Olivia Brown | Chicago | olivia@example.com | 2024-06-01(10 rows)Before we look at how a table behaves differently from an Excel or Google Sheets tab, let's name its four parts—along with the synonyms you will hear across data teams:
- Table: a named collection of rows sharing the same columns. This table is named
customers, and it has 10 rows and five columns. - Column (or field): a named vertical slice that holds one specific attribute for every record. The five columns in
customersarecustomer_id,name,city,email, andsignup_date. - Row (or record): one complete horizontal entry describing a single item or person. For instance, the record with
customer_id3is Priya Shah inAustin, and the record withcustomer_id8is Hana Sato. - Value: a single piece of data at the intersection of one row and one column—such as
Austinin thecitycolumn for Priya Shah (customer_id3), or2024-03-11insignup_dateforcustomer_id4.
A spreadsheet also organizes data into rows, columns, and cells. Underneath that visual grid, however, a database table breaks from spreadsheet rules in three ways.
Columns have declared types, not free-form cells
In a spreadsheet, you can type a number in C2, a note in C3, and a formula in C4. In the DuckDB tables in this course, each column has a declared type—integers in
customer_id, dates insignup_date, and text inname,city, andemail—so operations work consistently down the whole column.Values are addressed by data, not cell coordinates
A spreadsheet assigns every cell a grid address like B4 or D9 built from its column letter and row number. A SQL table has no column letters and no fixed row coordinates. You specify a value by naming its column and identifying the row through its values.
Row order belongs to your query, not the table
In a spreadsheet, row 3 names a position between row 2 and row 4, even when sorting changes which record occupies it. A SQL table is a collection of records with no portable guaranteed row order; when you need a specific sequence in your output, you ask for it in your query with
ORDER BY.
Let's see how those three differences play out in the customers table above.
Declared types and NULL vs. empty strings
In DuckDB and PostgreSQL, a column's declared type governs every row in that column. Not every SQL engine handles typing identically—SQLite uses flexible column typing by default unless you create STRICT tables, a difference we will cover later—but in our course tables, a date column holds dates and an integer column holds integers.
Compare the email value for customer_id 4 (Sam Lee in Chicago) with customer_id 5 (Marcus Bell in Denver). Sam Lee in Chicago has NULL, whereas Marcus Bell has an empty string (""), which prints as blank space. In a spreadsheet, both look like empty cells. In SQL, NULL (also shown in city for Julia Kim at customer_id 6) is a dedicated marker meaning a value is missing or unknown, while an empty string is a known piece of text with zero characters. You will learn how types and NULL behave in Module 2. If you want another angle on how NULL differs from blank text, ask your Maestro.
Why visual row order can fool you
In the customers output above, customer_id appears in neat order from 1 to 10. That does not mean a database engine randomly shuffles rows on every scan—DuckDB preserves insertion order in many simple operations, which is why the rows look fixed here. Nor does SQL forbid duplicate rows unless a table is defined with constraints that prevent them. What SQL leaves out is any portable guarantee of row order on the table itself: after updates, parallel execution, or moving data to another DBMS, the same SELECT * FROM customers; query can return rows in a different order. You will use ORDER BY in Module 3 whenever result order matters.
From spreadsheet coordinates to table values
Worked example · 3 steps
Suppose you want Priya Shah's city, or the signup date for the Sam Lee who lives in Chicago, from the customers table. In a spreadsheet you might scan down the row numbers and click C4 or E5. How do you pinpoint each value in database terms?
Work out the next step yourself, then open it to compare.
A good place to stop. Up next: part 2 of 2 · 3 min
Try it
Use the customers transcript above to answer the two checks below. For the first, look up the person in the table and describe the target value using a column name and an identifying value rather than a grid coordinate. For the second, think about what a SQL table promises—and doesn't promise—when a query runs without ORDER BY. If you'd like to talk through either scenario before or after answering, ask your Maestro.
Next up, you will compare SQL tables with another tool you may already know: Python and R DataFrames.