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
Math,
1 month ago
English,
1 month ago
Environmental Sciences,
1 month ago
Math,
3 months ago
Math,
3 months ago
Physics,
10 months ago
Business Studies,
10 months ago