Tables, Rows, and Columns
How a database organizes information
A database does not just dump all your information into one giant pile. It organizes everything into tables. You can picture a table a lot like a single tab in a spreadsheet. Each table is meant to hold one kind of thing: a table of users, a table of blog posts, a table of products.
Every table is built from two ideas: columns and rows.
Columns describe what kind of information is stored
A column is a labeled slot for one piece of information, repeated for every entry in the table. For example, a users table might have columns called id, username, email, and created_at. Every single user in that table will have a value for each of those columns.
Rows are the individual entries
A row is one single record: one specific user, one specific blog post, one specific product. If your website has 200 people signed up, your users table has 200 rows, and each row has its own username, its own email, and so on.
Here is a small users table written out as plain text, so you can see the shape of it:
id | username | email
1 | ana | ana@example.com
2 | ben | ben@example.com
3 | cleo | cleo@example.comReading this, you can see three columns (id, username, email) and three rows, one for each person. Every row fills in a value for every column.
A quick preview of data types
Notice that id holds numbers, while username and email hold text. Every column in a database has a data type, a rule about what kind of value is allowed in it. You will meet data types properly later in this course, when you create your own table. For now, just notice that different columns tend to hold different kinds of values.
Why organizing data this way matters
Splitting information into tables, rows, and columns is what lets a database find, sort, and update things reliably, even when there are millions of rows. A blog might have a posts table completely separate from a comments table, because a post and a comment are different kinds of things, even though they are related. You will learn how separate tables connect to each other later in this course.
Quick check
Q1 In a database table, what does a single row represent?
Q2 What do the columns of a table define?
Want to save your progress? It's free.
Create a free account