Revising the Select Query II
In this post we are going to discuss the SQl hackerrank Revising the select query 2 solution.
In the previous post we have discussed the Revising the Select Query 1 Solution click on the link to view that post.
So the problem statement for this is as follows:
Query the NAME field for all American cities in the CITY table with populations larger than 120000. The CountryCode for America is USA.
The CITY table is described as follows:
SQL Query:
select NAME from CITY where COUNTRYCODE='USA' and POPULATION>=120000
Explaination:
- In this question we are asked to query the names of all american cities whose population is more than 120000.
- So we first select all city names with Select NAME from CITY and then we apply the condition that the country should be america i.e COUNTRYCODE is "USA" and population is greater than 120000 .
- Finally we run the query and got the outcome as follows.
Output:
Sample Test Case
Test Cases:
0 Comments
Please Let me Know, If you have any doubts.