LIMITED TIME OFFER: 50% OFF OF PREMIUM WITH OUR ANNUAL PLAN (THAT'S $294 IN SAVINGS).
GET OFFER

Where did I do wrong in this mission: "Join more than three tables"

Screen Link: https://app.dataquest.io/m/189/intermediate-joins-in-sql/3/joining-more-than-three-tables

My Code:

SELECT
    il.track_id,
    t.name track_name,
    at.name artist_name,
    mt.name track_type,
    il.unit_price,
    il.quantity,
FROM invoice_line il
INNER JOIN track t ON t.track_id = il.track_id
INNER JOIN media_type mt ON mt.media_type_id = t.media_type_id
INNER JOIN album ab ON ab.album_id = t.album_id
INNER JOIN artist at ON at.artist_id = ab.artist_id
WHERE il.invoice_id = 4

What I expected to happen: Return the result of the querry

What actually happened:

(sqlite3.OperationalError) near "FROM": syntax error
[SQL: SELECT     il.track_id,     t.name track_name,     at.name artist_name,     mt.name track_type,     il.unit_price,     il.quantity, FROM invoice_line il INNER JOIN track t ON t.track_id = il.track_id INNER JOIN media_type mt ON mt.media_type_id = t.media_type_id INNER JOIN album ab ON ab.album_id = t.album_id INNER JOIN artist at ON at.artist_id = ab.artist_id WHERE il.invoice_id = 4]
(Background on this error at: http://sqlalche.me/e/e3q8)

You have a comma after il.quantity just before the FROM line.
It happens to me all the time.
:grinning:

2 Likes

Haha, so simple. Thanks.