AI Hints
Home›SQL Tutorial›Welcome to SQL
SQL · Lesson 2 of 126

Tables, Rows and Columns

A database is a set of tables.

⏱ 2 min read▶ Video at 1:30🎓 Free
Watch this lesson in the SQL courseWatch on YouTube ↗Full SQL course

If you've ever used a spreadsheet, you already understand most of a database. A database is just a collection of tables. And a table looks exactly like a spreadsheet, with columns across the top and rows going down.

Tables, Rows and Columns
From the video: Tables, Rows and Columns
  • You already know spreadsheets
  • A database is a set of tables
  • Each table looks like a sheet

The books table

Here's one table from Helen's shop, called books. Each column holds one kind of information, like the title, the author, or the price. Each row is one book. So this row says that The Silent Orchard, by Mira Hale, is a mystery that costs fourteen ninety nine. That's all a table is.

book_idtitleauthorgenreprice
1The Silent OrchardMira HaleMystery14.99
2Code of the RiverTom AveryThriller12.99
3Stars Over LagosAda ObiRomance9.99
4A Short History of BreadLena FoxHistory19.99

Three words to remember

Let's lock in three words. A table is a list of one kind of thing, like books or customers. A column is one piece of information about each thing, like the price. And a row is one single thing, like one book. You'll hear these words in every lesson.

keyvalue
Tablea list of one kind of thing
Columnone piece of information
Rowone single thing

Helen's five tables

Helen's database has five tables. Customers, with five hundred people who've signed up. Books, with the thirty titles she sells. Orders, with one row for every order placed. Order items, which lists the books inside each order. And staff, with the eight people who work there. Over the course, you'll use every one of them.

customers500 people
books30 titles
orders1,598 orders
order_itemsbooks in each order
staff8 people

Summary

A database is a set of tables, and each table has columns and rows. Now let's get SQL running on your computer, so you can follow along.

Key takeaways
  • Tables hold one kind of thing
  • Columns are details
  • Rows are single items
Next up: Getting Set Up — SQLite in two minutes