Answer the question
In order to leave comments, you need to log in
MySQL, how to display fields from different tables using scalar subqueries?
How can I display the number of flights and the person's name if they are in different tables?
1 task for self-
checking You
can't merge tables
Here is the task itself
This is the database schema
Answer the question
In order to leave comments, you need to log in
What if the passenger checked in but did not buy tickets?
And if several passengers have the same name?
This is how you can do it with table joins:
SELECT COUNT(pit.id) AS count, MAX(p.name) AS name
FROM Passenger AS p
LEFT JOIN Pass_in_trip AS pit ON p.id = pit.passenger
GROUP BY p.id
SELECT (SELECT COUNT(pit.id) FROM Pass_in_trip AS pit WHERE p.id = pit.passenger) AS count, p.name
FROM Passenger AS p
what is the meaning of copy-paste in this case? turn on the brain
error in unrecorded namesakes.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question