Demonstrates how to return data from two tables by joining them together. Explains the assumptions the database makes in order to affect the merge
- [Woman Instructor] Sometimes you need data…from more than one table.…So let's say we want a report of all customers…who are living in Buenos Aires.…We can't return that data just from the customer table…because the customer table doesn't store the address.…So what we need to do is merge or join data from two tables.…The basic structure of a join is straight forward.…You've got select fields, in this case everything,…from table one,…join table two,…and then we use ON to stipulate…how we want the database to knit the data together,…and when we run that…we are returned all five fields from the customer table,…followed by all 12 fields from the address table.…
So it's given us everything from both tables side by side.…Let's have a look at this query in a bit more detail.…After the ON keyword,…we supply the two field names that we want to merge on,…and we want to merge on address_id,…which is the primary key of one table…and a foreign key in the other.…But we couldn't just say ON address_id equals address_id…because if we run that, we'd get an error that says…
Join Emma Saunders as she shows you how to design and write simple SQL queries for data reporting and analysis. Review the different types of SQL, and then learn how to filter, group, and sort data, using built-in SQL functions to format or calculate results. Learn a bit about data types and database design. Discover how to perform more complex queries, such as joining data together from different database tables. Last but not least, Emma shows how to save your queries as views, so you can run them again and again.
- Using different versions of SQL
- Retrieving data with SELECT statements
- Filtering and sorting your results
- Transforming results with built-in SQL functions
- Grouping SQL results
- Merging data from multiple tables
- Identifying data types, and how to make sense of your database design
- Saving SQL queries
Skill Level Intermediate
1. Use SQL to Report Data
Data types in SQL databases5m 47s
2. Group your SQL Results
3. Merge Data from Multiple Tables
4. Advanced Features and Taking Your Learning Forwards
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.