Lesson 3 / 28
Databases vs Tables
A server can host many databases, each holding many tables.
Creating & selecting a database
A database is a named container for tables. USE switches your active database.
CREATE DATABASE shop;
USE shop;
SHOW TABLES;
Output:
Empty set (0.00 sec)
One server, many databases
A single MySQL server commonly hosts several databases — one per application — each isolated with its own set of tables.
Quick check: What does `USE shop;` do?
- Creates a new database
- Makes `shop` the active database for following queries
- Deletes the `shop` database
Answer
Makes `shop` the active database for following queries — `USE` just switches context — no data is created or removed.