Answer the question
In order to leave comments, you need to log in
How to write a request to get the N most populated cities?
The database (MySQL) has 2 tables for storing cities and users living in them:
city(id, name);
user(id, name, city_id);
Answer the question
In order to leave comments, you need to log in
Firstly, it was not completely copied from the training manual))) There should also be a table or column in the table where the data on the population itself is actually)))
Secondly, the author, if your task sounds like this:
then here is my answer and solution to the question:
UPD. Oh sent, thanks! Right now I'll sketch by hand)))
The first part:
SELECT * FROM city, user WHERE (тут будет вторая часть кода) LIMIT $n
Just by analogy + add sorting and limit:
www.sql.ru/forum/749635/podskazhite-s-count-v-svya...
In general, study the possibilities of Google - it helps
while you are a web programmer - this means that there are giant search engines and there is the Internet
UPD: and yes, it is better not to do such questions under "I'm looking for a job"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question