Consider the schema with below tables
L
Table Name
Columns
people
company_id, id, name
companies
id, location_id, name
locations
id, name
For the location with the most companies, list the names of the people and the
companies they work for.
The output should consist of: User_Name Company Name Location
Attachments:
Answers
Answered by
0
Answer:
what do you want in this sorry
Answered by
0
Answer:
select p.name, c.name,l.name from people p join
companies c on p.company_id = c.id
join locations l on c.location_id = l.id
where l.id in (
select distinct location_id from
(select c.location_id,count(distinct id) from companies c group by c.location_id order by count(distinct c.id) desc limit 1) sql_sikh_lo_didi);
Explanation:
Read SQL
Similar questions
Social Sciences,
1 month ago
Physics,
1 month ago
English,
1 month ago
Math,
2 months ago
Math,
2 months ago
Physics,
9 months ago
Business Studies,
9 months ago