Revising the Select Query I HackerRank Solution | Codeityweb

Revising the Select Query 1

In this post we are going to discuss SQL hackerrank revising the select query 1 solution.

So here is the problem statement.


Query all columns for all American cities in the CITY table with populations larger than 100000. The CountryCode for America is USA.

The CITY table is described as follows: 

 

City Table


The solution is easy and straight forward.

Sql Statement:

select * from CITY where COUNTRYCODE='USA' and POPULATION>=100000;


Explaination:

  • The question says to select all cities where country code is USA and whose population is more than 100000,So we use Select * from city to select all cities from the table.
  • Now we give a condition mentioning that we want only those cities whose country code is USA and the population must be greater than or atleast equal to 1 lakh i.e 100000
  • Finally we run the query to check the outcomes , here is what we get.

 

Output:

 

Revising the select query 1- hackerrank solution


Thank you for Reading!

Post a Comment

0 Comments