![](https://i0.wp.com/media.dev.to/cdn-cgi/image/width=1000,height=500,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr57vtpdz0psk6bpy30s9.png?w=1200&ssl=1)
Problem Statement:
Query the names of all Japanese cities in the CITY table. The COUNTRYCODE
for Japan is JPN
.
Link: HackerRank – Japanese Cities Name
Solution:
SELECT NAME FROM CITY WHERE COUNTRYCODE = 'JPN';
Explanation:
-
SELECT NAME
: This part of the query specifies that you want to retrieve theNAME
column from the CITY table. -
FROM CITY
: Indicates that you are selecting data from the CITY table. -
WHERE COUNTRYCODE = 'JPN'
: This condition filters the rows to include only those cities where theCOUNTRYCODE
is ‘JPN’ (Japan).
Discover more from Coursity
Subscribe to get the latest posts sent to your email.