[220909] SQL 연습 #1
Solve SQL Code Challenges
A special-purpose language designed for managing data held in a relational database.
www.hackerrank.com
앞으로 풀 SQL코딩테스트 중 하나는 Hacker rank! 기초부터 차례로 풀 수 있움
프로그래머스랑 같이 할 예정 입니다!

올릴 문제는 너무 간단한거 빼고 기초 확인 가능한거랑 헷갈린거 위주입니다.
2022.09.09
The CITY table is described as follows:
[Revising the Select Query I]
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;
[Select By ID]
Query all columns for a city in CITY with the ID 1661.
SELECT * FROM CITY
WHERE ID=1661;
[Weather Observation Station]
#3
Query a list of CITY names from STATION for cities that have an even ID number. Print the results in any order, but exclude duplicates from the answer.
--중복제외 / ID 짝수--
SELECT DISTINCT CITY FROM STATION
WHERE ID%2=0;
#4
Find the difference between the total number of CITY entries in the table and the number of distinct CITY entries in the table.
For example, if there are three records in the table with CITY values 'New York', 'New York', Bengalaru', there are 2 different city names: 'New York' and 'Bengalaru'. The query returns 1
SELECT COUNT(*) - COUNT(DISTINCT CITY)
FROM STATION;
역시 쉬운거 할때가 젤 재밌다;ㅡ;
양으로 승부 볼 생각이라 얼른 또 풀러 튀튀..