Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Databases SQL Reporting by Example Day 3: Getting Good at Grouping Multi-Subject Teachers

What does .* mean in SQL?

Hi, does anyone know what .* does in SQL that Ben used in this video?

2 Answers

It means ALL
SELECT * FROM Car means select All Car Columns from the Car Table

Thanks so much wc93! That makes sense now 😅

Travis Williams
Travis Williams
5,786 Points

I think the specific question was about adding period and asterisk .* to the end of a table name.

SELECT * from TEACHERS
JOIN CLASSES ON CLASSES.TEACHER_ID = TEACHERS.ID
;

VS

SELECT TEACHERS.* FROM TEACHERS
JOIN CLASSES ON CLASSES.TEACHER_ID = TEACHERS.ID
;

In the first case, since we are joining the TEACHERS & CLASSES table the * would produce all columns from both tables, but in the second case, we are selecting ONLY the columns from the TEACHERS table with TEACHERS.*

We have access to all columns to report on, but are only displaying results from the TEACHERS table, and not the CLASSES table.