티스토리 뷰
1. Select All
SELECT *
FROM CITY;
2. Weather Observation Station 1
SELECT CITY,STATE
FROM STATION;
3. Revising the Select Query I
SELECT *
FROM CITY
WHERE POPULATION > 100000 AND COUNTRYCODE = 'USA';
4. Select By ID
SELECT *
FROM CITY
WHERE ID = '1661';
5. Weather Observation Station 6
Q. Query the list of CITY names starting with vowels (i.e., a, e, i, o, or u) from STATION. Your result cannot contain duplicates.
SELECT DISTINCT city
From station
WHERE city LIKE 'a%'
OR city LIKE 'e%'
OR city LIKE 'o%'
OR city LIKE 'i%'
OR city LIKE 'u%';
6. Weather Observation Station 12
Q. Query the list of CITY names from STATION that do not start with vowels and do not end with vowels. Your result cannot contain duplicates.
SELECT DISTINCT city
From station
WHERE city NOT LIKE 'a%'
AND city NOT LIKE 'e%'
AND city NOT LIKE 'o%'
AND city NOT LIKE 'i%'
AND city NOT LIKE 'u%'
AND city NOT LIKE '%a'
AND city NOT LIKE '%e'
AND city NOT LIKE '%o'
AND city NOT LIKE '%i'
AND city NOT LIKE '%u';
1. Revising Aggregations - Averages
2.
SQL사이트
- https://www.w3schools.com/sql/trysql.asp?filename=trysql_select_all
https://www.hackerrank.com/challenges/weather-observation-station-1/problem
'Programming > DATABASE' 카테고리의 다른 글
[MSSQL/DB] DATABASE 생성 (0) | 2022.05.09 |
---|---|
[DATABASE] 데이터모델링 1. 논리 데이터 모델링 (0) | 2022.04.26 |
[DATABASE/MySQL] MySQL - CRUD (0) | 2021.01.18 |
[DATABASE/MySQL] MySQL Install (0) | 2021.01.18 |
[DATABASE] Oracle SQL 개념 정리 - 프로시저, 뷰, 트리거 ,인덱스, 시퀀스, 클러스터 (0) | 2020.08.25 |
댓글