Query the names of all the Japanese cities in the CITY table. The COUNTRYCODE for Japan is JPN.

 The CITY table is described as follows:


SOLUTION:

SELECT NAME FROM CITY WHERE COUNTRYCODE='JPN';

EXPLANATION:

  • SELECT NAME:
    This tells the database you only want to retrieve the values from the NAME column of the table — in this case, the names of the cities.

  • FROM CITY:
    This tells the database which table to look in — the CITY table.

  • WHERE COUNTRYCODE = 'JPN':
    This is a filter condition. You're telling the database:

    "Only give me the rows where the COUNTRYCODE column has the value 'JPN'."

    Since 'JPN' is the code for Japan, this condition ensures that only Japanese cities are included in the result.

Popular posts from this blog

In this problem, you will practice your knowledge on interfaces - Hacker Rank Solution.