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

When a method in a subclass overrides a method in superclass, it is still possible to call the overridden method using super keyword - Hacker Rank Solution.

You are given a date. You just need to write the method getDay which returns the day on that date - Hacker Rank Solution.

Java's System.out.printf function can be used to print formatted output. The purpose of this exercise is to test your understanding of formatting output using printf. To get you started, a portion of the solution is provided for you in the editor; you must format and print the input to complete the solution.