0

I'm doing a database about attractions in a certain state, and I have these tables:

The first table is for the cities in a state

cities table

The other table is for wineries in those cities

wineries table

I'm having trouble printing the wineries and cities name together, any suggestions?

2
  • Please read meta.stackoverflow.com/questions/285551/… and the accepted answer Commented Apr 28, 2017 at 7:21
  • Which DBMS are you using? Postgres? Oracle? Commented Apr 28, 2017 at 7:21

1 Answer 1

3

You can use join keyword to join two tables, for example:

select w.winery_Name, c.city_Name from Wineries w
inner join Cities c on w.city_ID = c.cities_ID;

enter image description here

Sign up to request clarification or add additional context in comments.

3 Comments

Glad to help you, feel free to accept my answer :) thanks
Could please explain why you used w and c here "w.winery_Name, c.city_Name"
To get object reference. So 'w' is Wineries instance with winery_Name field inside.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.