Category: Exercises

Japanese Cities’ Attributes

Query all attributes of every Japanese city in the CITY table. The COUNTRYCODE for Japan is JPN. SELECT Id, Name, CountryCode, District, Population FROM City WHERE countryCode = 'JPN'; The query to get all attributes from the CITY table for which the COUNTRYCODE is JPN is very simple. According to logical query processing, the query … Continue reading Japanese Cities’ Attributes

Revising the Select Query II

Query the names of all American cities in CITY table with a population greater than 120000. The CountryCode for America is the USA. The CITY table: FieldTypeIDNUMBERNAMEVARCHAR(20)COUNTRYCODEVARCHAR(20)DISTRICTVARCHAR(20)POPULATIONNUMBER SELECT Name FROM City WHERE population > 120000 AND CountryCode = 'USA'; As per logical query processing, we'll start with the FROM clause. The query takes the CITY … Continue reading Revising the Select Query II

Revising the Select Query I

Query all columns for all American cities in CITY with populations larger than 100000. The CountryCode for America is the USA. FieldTypeIDNUMBERNAMEVARCHAR(17)COUNTRYCODEVARCHAR(3)DISTRICTVARCHAR(20)POPULATIONNUMBER SELECT Id, Name, CountryCode, District, Population FROM City WHERE population > 100000 AND countrycode = 'USA'; Explanation According to logical query processing, our query will start from the FROM clause and will use … Continue reading Revising the Select Query I