MySQL
MySQL

Tables

A table is where the actual data lives inside a database. It's shaped like a grid: columns define what kind of information is stored (name, age, email), and rows are the individual records (one row per student, one row per order). Every column has a name and a data type, decided when the table is created you'll cover data types in more detail in the next topic. A table also usually has a way to uniquely identify each row, most commonly a primary key column like id. You can see what tables exist inside the current database with SHOW TABLES;, and see a table's column structure with DESCRIBE table_name; (or the equivalent DESC table_name;). A well-designed table represents exactly one kind of thing a students table holds student records, not student records mixed with unrelated order records. That single-purpose idea becomes especially important once you reach database design and normalization later in this course.

Why this matters

  • ·Tables give data a consistent, predictable shape that's easy to query.
  • ·DESCRIBE lets you quickly check a table's columns and types without opening a full GUI.
  • ·Keeping one table per kind of thing makes a database far easier to understand and extend.

Common mistakes

  • ·Mixing unrelated data into one table (like students and products together) makes queries confusing and error-prone.
  • ·Forgetting a way to uniquely identify rows makes it hard to update or delete exactly the record you mean.
  • ·Changing a table's structure carelessly after it already has real data can break existing rows or queries.
Your codePHP
Expected output
+-------------------+
| Tables_in_school  |
+-------------------+
| grades            |
| students           |
+-------------------+
2 rows in set

PHP runs on a server, not in the browser this shows the expected output instead of a live one.

Frequently asked questions

One individual record in a table for example, one specific student.

Practice questions

Question 1

Write the command that lists every table in the current database.

Your codePHP
Expected output

PHP runs on a server, not in the browser this shows the expected output instead of a live one.

Question 2

Write the command that shows the column structure of a table called students.

Your codePHP
Expected output

PHP runs on a server, not in the browser this shows the expected output instead of a live one.

Quick check

Just for this topic answer honestly, then check yourself.

1 / 3

What does a table row represent?