DEV Community

Luckshvadhan B
Luckshvadhan B

Posted on

Basic Select SQL Queries

Get all details of city with id 1661
Filter CITY table where id equals 1661 and return all columns

Get all cities from Japan
Filter CITY table where countrycode is JPN and return all columns

Get all cities from Japan
Same filter using countrycode JPN to retrieve all records

Get city names not starting with vowels
Use pattern filtering to exclude names starting with A E I O U and remove duplicates

Get city names not starting with vowels
Apply same condition with distinct to avoid repeated values

Get city names not starting with vowels
Filter using NOT LIKE patterns and ensure unique results

Find difference between total and unique city entries
Subtract count of distinct city names from total count

Get names of Japanese cities
Select only city name where countrycode is JPN

Get names of Japanese cities
Same filtering on countrycode but return only name column

Top comments (0)