![]() We'll look at how to write these joins soon, but if we joined our user information to our address information we could get a result like this: id | name | email | age | id | street | city | state | user_id ![]() We could write separate queries to retrieve both the user information and the address information-but ideally we could write one query and receive all of the users and their addresses in the same result set. +-+-+-+-ġ | 1234 Main Street | Oklahoma City | OK | 1Ģ | 4444 Broadway Ave | Oklahoma City | OK | 2 +-+-+-Īnd the rows from the table that stores address information might look like this: id | street | city | state | user_id The rows from the table that stores user information might look like this: id | name | email | age Let's take for example a system that stores information about users and their addresses. These rows are usually from two different tables-but they don't have to be.īefore we look at how to write the join itself, let's look at what the result of a join would look like. ( Spoiler alert: we'll cover five different types-but you really only need to know two of them!) What is a join?Ī join is an operation that combines two rows together into one row.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |