Back to articles
basic select sql queries

basic select sql queries

via Dev.to TutorialSharmila devi

Query all columns for a city in CITY with the ID 1661 select * From city where id=1661; Query all columns for all American cities in the CITY table with populations larger than 100000. The CountryCode for America is USA. Select * From city where COUNTRYCODE = 'USA' and population > 100000; Query all attributes of every Japanese city in the CITY table. The COUNTRYCODE for Japan is JPN. select * from city where countrycode = 'JPN'; Find the difference between the total number of CITY entries in the table and the number of distinct CITY entries in the table. select count(city) - count(distinct city) from station; * Query the NAME field for all American cities in the CITY table with populations larger than 120000. The CountryCode for America is USA. * select NAME from city where COUNTRYCODE = 'USA' and POPULATION > 120000; 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'; Query the list of CITY n

Continue reading on Dev.to Tutorial

Opens in a new tab

Read Full Article
6 views

Related Articles