You are on page 1of 2

23:45 21/04/2024 Skill Assessment

Back to Results

Data Management in SQL (PostgreSQL)

Question 12

Advanced

Intermediate

Novice

1 2 3 4 5 6 7 8 9 10 11 12 13

There was an error in your code BETA

In your code, you forgot to include the INNER JOIN clause to specify how the two tables (bike_trips and bike) are related.
Without this clause, the database does not know how to join the tables together, resulting in the incorrect output of [object
Object],[object Object]. By adding the ON t.bike_ID = b.bike_ID clause in the correct code, you are telling the database
to match the bike_ID column in both tables to properly join the data and produce the desired output.

Was the AI Assistant helpful?

Yes No

Join the bike_trips table with bike but only keep all the matched records.

-- bike_trips
| trip_ID | duration | bike_ID |
|---------|----------|---------|
| 364 | 60 | 5000 |
| 365 | 900 | 2300 |
| 366 | 720 | 5002 |

-- bike
| bike_ID | last_date_in_use | color |
|---------|------------------|-------|
| 2300 | 2020-04-15 | blue |
| 2350 | 2020-04-15 | green |
| 3000 | 2020-04-18 | green |

Complete the code to return the output

SELECT Trip_ID, Duration, t.bike_ID, last_date_in_use, color


FROM bike_trips AS t
bike AS b
;
INNER JOIN bike AS b
ON t.bike_ID = b.bike_ID;

Expected Output Your Output

syntax error at or near "{"


trip_id duration b i ke _ i d last_date_in_use colo
LINE 3: {{option}} bike AS b
^
365 900 2300 2020-04-15 blue

https://assessment-v2.datacamp.com/15e09043-62d9-4b3e-a10c-638c40a5ea4c/review?returnUrl=https%253A%252F%252Fapp.datacamp.com%252Fcertificat… 1/2
23:45 21/04/2024 Skill Assessment

Incorrect answer

Difficulty MEDIUM

Skill Joining Multiple Datasets

Report Issue

https://assessment-v2.datacamp.com/15e09043-62d9-4b3e-a10c-638c40a5ea4c/review?returnUrl=https%253A%252F%252Fapp.datacamp.com%252Fcertificat… 2/2

You might also like