Revising the Select Query II Hackerrank Solution | Codeityweb

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:

 

Revising the select query 2-hackerrank solution

 

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

Revising the select query 2-hackerrank


Test Cases:

Revising the select query 2 -hackerrank solution


Thank You for Reading!

Post a Comment

0 Comments