1.Revising the Select Query I
Query all columns for all American cities in CITY with populations larger than 100000. The CountryCode for America is USA.
SELECT * FROM CITY WHERE COUNTRYCODE = 'USA' AND POPULATION > 100000
2.Revising the Select Query II
Query the names of all American cities in CITY with populations larger than 120000. The CountryCode for America is USA.
SELECT NAME FROM CITY WHERE POPULATION > 120000 AND COUNTRYCODE = 'USA'
3.Query all
Query all columns (attributes) for every row in the CITY table.
SELECT * FROM CITY
4.Select By ID
Query all columns for a city in CITY with the ID 1661.
SELECT * FROM CITY WHERE ID = 1661
5.Japanese Cities’ Attributes
Query all attributes of every Japanese city in the CITY table. The COUNTRYCODE for Japan is JPN.
SELECT * FROM CITY WHERE COUNTRYCODE = 'JPN'
6.Japanese Cities’ Names
Query the names of all the Japanese cities in the CITY table. The COUNTRYCODE for Japan is JPN.
SELECT NAME FROM CITY WHERE COUNTRYCODE = 'JPN'
7.Weather Observation Station 1
Query a list of CITY and STATE from the STATION table.
SELECT CITY,STATE FROM STATION
8.Weather Observation Station 3
Query a list of CITY names from STATION with even ID numbers only. You may print the results in any order, but must exclude duplicates from your answer.
select distinct city from station where (id % 2) = 0
(distinct 去重)
..待续