Answer the question
In order to leave comments, you need to log in
How to make a selection on 2 tables?
The database has a USERS table with id and name fields, and a USER_LOGINS table with user_id and login_time fields. Write a SQL query that will receive a selection with user_name, login_time fields for USER_LOGINS rows.
How to write a query correctly?
I figured out that I need to use the join operator, but I can’t think through the answer until it turns out like this:
SELECT users.Name AS user_name, user_logins.Login_time AS last_login
FROM users
LEFT OUTER JOIN
user_logins
Answer the question
In order to leave comments, you need to log in
I hope my short tutorial will help you deal with selections as well.
in join it is necessary to specify on what field to connect tables.
or so (if the name of the key field in the tables is the same)select * from table1 join table2 using(id)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question