SQL and MySQL course Β· Module 1: Introduction to databases
Welcome to the Great Library!
In this lesson3
Welcome to the walls of the Great Library of Alexandria - the greatest treasury of knowledge of the ancient world! I am Callimachus, Keeper of the Catalog. It was I who created the Pinakes - a catalog regarded as the first library catalog of the West, which lets you find any work among hundreds of thousands of scrolls.
Today I will teach you the art that lies at the heart of every library - data management. In our world MySQL will help us with it - a system that stores data and carries out our commands.
What you will learn
- recognize the parts of a database: table, row, column and primary key,
- explain what MySQL is and how a client talks to it,
- retrieve data with the
SELECT ... FROM ...spell: all columns or only chosen ones, - write readable queries: with a semicolon, UPPERCASE keywords and comments.
What is a database?
Imagine our Library:
- Shelves (halls) are tables - each shelf holds one kind of thing: one for book scrolls, another for reader lists.
- Scrolls on a shelf are rows (records) - each scroll describes a single book.
- The fields on a scroll (title, year of publication, price) are columns.
- The whole Library is a database - an organized collection of all the shelves.
A database is simply an organized way of storing information so it can be quickly saved, found, changed and deleted.
Example: a shelf of books
| id | tytul | rok_wydania | cena |
|---|---|---|---|
| 1 | Iliad | -750 | 25 |
| 2 | Odyssey | -720 | 30 |
| 3 | Republic | -375 | 40 |
This is a part of the ksiazki table - you can see 3 rows (three books) and 4 columns (id, tytul, rok_wydania, cena). You will meet the other fields of this shelf in the "Map of the Library shelves" lesson.
Every row has a unique identifier in the id column - like a scroll's catalog number. Thanks to it we will never confuse two books, even if they share the same title.
In this land you will learn to speak with the Library in its own language - SQL. THE TREASURY AWAITS!
Spotted a mistake in this lesson?
Check yourself
Answer the questions from this lesson. Pick an answer to see right away whether it is correct.
1. What is a database?
2. In the Library metaphor: what is a TABLE?
3. In the Library metaphor: what is a ROW (record)?