From the course: Programming Foundations: Databases

Unlock the full course today

Join today to access over 24,000 courses taught by industry experts.

Joining tables

Joining tables

- [Instructor] One of the powerful features of relational databases is the ability to connect records across different relations or tables. Those relationships are part of our data model, and when we're getting data from a database, we can write a query that uses the connections between data to return us a useful result. If you recall, our customers table has a field for the customers' favorite dishes. I'll write a query to show those values. I'll write SELECT, FirstName, LastName, and FavoriteDish FROM Customers. And I'll run the query. This isn't extremely useful to us like this, because unless you're a little too familiar with the menu, you probably won't remember what dish 15 or 13 or three is. But we also have a table where those numbers line up with the name of a dish. That's our Dishes table. We can use the JOIN keyword to tell the database to consider two tables, our Customers table and our Dishes table…

Contents