What is a database?
016 min
You use databases every day without noticing. The contacts on your phone, your bank account, your grades at university, your rides in a taxi app — all of it lives in a database somewhere.
A database is organised data
Imagine the dean’s office keeps its list of students in a notebook. A hundred students — manageable. But ten thousand, each with grades, a group and a scholarship… Finding one person, or answering “how many students study on a grant?”, would take hours.
A database is a program that stores information so that you can find, count and change what you need in an instant.
Tables, rows, columns
The most common databases are relational. They keep data in tables, much like a spreadsheet:
| id | first_name | last_name | course | city |
|---|---|---|---|---|
| 1 | Aziz | Karimov | 2 | Toshkent |
| 2 | Malika | Yusupova | 1 | Samarqand |
| 3 | Bobur | Aliyev | 2 | Buxoro |
- A table is a list of things of one kind: students, subjects, orders.
- A row is one thing: one student.
- A column is one property of that thing: name, year of study, city.
Every column has a type: course holds only numbers, first_name holds text, birth_date holds a date. The database refuses a value of the wrong type, so the data stays clean.
What is SQL?
You cannot ask a database a question in plain English — there is a special language for it: SQL (Structured Query Language, pronounced “ess-cue-ell” or “sequel”). It appeared in the 1970s and still works in almost every database.
An SQL query reads like a simple English sentence:
SELECT first_name, city FROM students WHERE course = 2;“Select the first name and city of 2nd-year students from the students table.” That is it — the database works out how to search on its own.
PostgreSQL and MySQL
SQL is the language; PostgreSQL and MySQL are programs that understand it (they are called DBMS — database management systems).
- PostgreSQL is the most advanced open-source database, chosen for complex calculations and large projects.
- MySQL is the most widespread database; a large share of the web runs on it.
The core SQL is the same in both. Where they differ, we show it separately — switch the course with the button at the top of the page and the text adapts to that database.
Your first query
Below is a real university database. Press “Run”:
You get a small table. Now try changing the query: write 10 instead of 5, or remove city. You cannot break anything — this database is read-only.
Show the names (name) of all faculties in the faculties table.
Remember
- A database is a program that keeps data organised.
- Data lives in tables: a row is one thing, a column is one of its properties.
- SQL is the language for asking questions; PostgreSQL and MySQL are systems that understand it.