M
M
Michael Vasyukov2017-12-02 17:36:10
SQL
Michael Vasyukov, 2017-12-02 17:36:10

How to make a sql query to select data from several tables by FK?

Good day! I have the following question:
There are 3 tables:
dbo.Runner with fields:
RunnerId(PK, int, no null)
Email(FK, nvarchar(100), no null)
CountryCode(FK, nchar(3), no nukk)
Field Email(foreign key) is associated with the dbo.User table with fields:
Email(PK, nvarchar(100), no null) <- This field is associated with the Email field in the dbo.Runner table
FirstName(nvarchar(80), no null)
LastName (nvarchar(80), no null)
And the CountryCode(foreign key) field is associated with the dbo.Country table with fields:
ContryCode(PK, nchar(3), no null) <- This field is associated with the CountryCode field in the dbo.Runner table
CountryName(nvarchar(100), no null)
Actually the question is:
How to write an sql query to find data in the User and Country tables, using the Email field from the Runner table. Those. you need to find all fields by Email from the Runner table from the User table and do the same with the Country table, find all CountryName by CountryCode from the Runner table.
I hope I have explained my situation clearly. If something is not clear write!
PS Thank you very much!!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2017-12-02
@programmer_developer

Everything is in plain language.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question