T
T
tolsor2018-05-09 21:45:21
MySQL
tolsor, 2018-05-09 21:45:21

How to merge two tables that are linked by one another?

I'm doing a MySQL lab.
In the first task, you need to display the names of the students and the names of the corresponding streets. It's easy:

SELECT `dannie`.`fam`, `ulica`.`nazvanie` 
FROM `dannie` RIGHT OUTER JOIN `ulica` ON `dannie`.`kod_ulica` = `ulica`.`kod_ulica`

And how to do the second task - display the names of students and the names of the corresponding cities? The corresponding cities (from `gorod`) can be found through the corresponding streets, but I don't understand how to link the tables.
Database Schema:
5af244b6725f7207421974.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yan-s, 2018-05-09
@Yan-s

Joint 3 tables. Use the city id field from the street table for the city table join.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question