user2058186
user2058186

Reputation: 287

Database Diagram (ERD) Final Table

Full ERD

Is this Showroom table correct? I want to be able to see this data: Showroom

I'm just not sure how to reference MakeName, ModelName and Price in the showroom table, is it right as it is or do I need to change something?

Upvotes: 0

Views: 479

Answers (2)

sgeddes
sgeddes

Reputation: 62831

You don't want to have those fields in your ShowRoom table (unless that's just a View). Keep that table to your Id and your CarId. Then you can use INNER JOINs to return the appropriate data:

SELECT S.ShowRoomId, S.CarId, M.MakeName, Mo.ModelName, Mo.Price
FROM ShowRoom S
   INNER JOIN Car C ON S.CarId = C.CarId
   INNER JOIN Model Mo ON C.ModelId = Mo.ModelId
   INNER JOIN Make M ON Mo.MakeId = M.MakeId

Good luck.

Upvotes: 1

Itay k
Itay k

Reputation: 4471

This is correct. If you'll inner join showroom, car, make and model you'll get the right query

Upvotes: 1

Related Questions