Back to subject
MySQL/Tables

Look Inside a Database

Practical lesson

Let's read what a real database contains, one layer deeper than before.

SHOW TABLES; lists the tables that exist inside whichever database you've USE-d. In the example, the school database contains two tables: grades and students.

Each of those names tells you what kind of records live inside students holds one row per student, grades presumably holds one row per grade entry, likely connected back to students through a shared column like student_id (you'll cover that connection properly in foreign keys, later in this course).

If you wanted to see exactly what columns students has its name, age, and so on the next command would be DESCRIBE students;, which returns each column's name, type, and a few structural details.

Get into the habit of this three-step read: SHOW DATABASES, USE one, then SHOW TABLES it's how you'd start exploring any unfamiliar database, including a real one on the job.

Try it yourself
Code

Starter example

Code
SHOW TABLES;
Live preview
+-------------------+
| Tables_in_school  |
+-------------------+
| grades            |
| students           |
+-------------------+
2 rows in set