Database
A database stores data in connected tables, with rules for each column, so many people and programs can read and change it without stepping on each other.
Select any words here to ask your Maestro about them.
Ana Ruiz got a new phone number. In the orders sheet it appears on 5 rows. In a well-built database, how many rows do you change?
What it's for: storing data that many people and programs read and change at the same time, like a store's orders or a clinic's patients, without stepping on each other or contradicting themselves.
How it differs from a spreadsheet: each column takes one type of data, each row has a key that identifies it, and tables connect through those keys, like the customer_id in the figure. Knowing what each row stands for (the table's grain) is the first thing you need to count correctly.
You query databases with SQL. When someone says "the database", they might mean the data, the program that stores it (the database management system, like PostgreSQL or MySQL) or the app they connect from. To move data into Excel, it's usually exported as a CSV.
Learn it from scratch in SQL for Data People, which starts with this very word.
How it's used
How to query it
Every order with today's phone number, in SQL
- marked: SELECT o.order_id, c.name, c.phone
- FROM orders AS o
- JOIN customers AS c ON c.id = o.customer_id;JOIN attaches each order to its customer's row, using customer_id.
- 1041 | Ana Ruiz | (512) 555-0198The same query works for all 5 orders, and for every order after them.
When to look closer
When a JOIN inflates the total
orders and order_items, one row per product
- marked: SELECT SUM(o.total)
- FROM orders AS o JOIN order_items AS i ON i.order_id = o.order_id;
- $4,415
The query says $4,415. Do you think that's what the store sold on these 5 orders?
Ask your Maestro about Database
It answers from the free course page closest to this word, the way it answers while you study.
You: What does "Database" mean, in plain words?
Your Maestro: I'll explain it with a case of yours: it sticks better than a definition. Which piece of data at work is copied in many places and goes out of date?
Asking about: Answers from the page "How do you calculate a rate per 100,000 people?"
Only this browser keeps what you ask here. How it works
Learn more
Related terms
- Grain (of a table)
What one row of a table stands for: a person, a transaction, a planet, a person per language. Counting rows counts what you want only if you know the grain.
- CSV
A CSV (comma-separated values) is a plain-text file that holds a table: one row per line, with commas between the columns.
- pandas
pandas is a Python package for working with tables of data, called DataFrames: loading them, filtering rows, picking columns and summarizing them.