일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- 자바스크립트
- 9급경제학
- 비전공자 코딩
- 7급경제학
- 문과 개발
- 경제학기초
- 코딩
- 국내수출
- 경제학적설명
- 케이스메소드
- 비전공자개발자
- 경제학적기초지식
- 바닐라자바스크립트
- 배열메소드
- 비전공자 개발
- 금융기초
- 주식기초
- 개발자되기
- 주식과채권
- 경제학
- 콜드콜
- devlift
- 파생금융
- 경제학적개념
- 파생경제학
- 파생상품
- 개발자
- case method
- 채권기초
- 하버드MBA
- Today
- Total
deVSner
프로그래머스 sql - string, date 본문
1. 루시와 엘라 찾기
SELECT
animal_id,
name,
sex_upon_intake
from animal_ins
where name in ('lucy', 'ella', 'pickle', 'rogan', 'sabrina', 'mitty')
order by animal_id
in이 중요하다. 처음에 and로 했으나, 실패
https://www.w3schools.com/sql/sql_in.asp
SQL IN Operator
SQL IN Operator The SQL IN Operator The IN operator allows you to specify multiple values in a WHERE clause. The IN operator is a shorthand for multiple OR conditions. IN Syntax SELECT column_name(s) FROM table_name WHERE column_name IN (value1, value2, ..
www.w3schools.com
2. 이름에 el이 들어가는 개 찾기
SELECT
animal_id,
name
from animal_ins
where name like '%el%' and animal_type = 'dog'
order by name
헷갈렸던 점은, '조건이 2개일 때', 라는 상황이었다.
구글에 검색하니까 WHERE는 and, or , not, in 과 조합할 수 있었다.
https://www.w3schools.com/sql/sql_where.asp
SQL WHERE Clause
SQL WHERE Clause The SQL WHERE Clause The WHERE clause is used to filter records. The WHERE clause is used to extract only those records that fulfill a specified condition. WHERE Syntax SELECT column1, column2, ... FROM table_name WHERE condition; Note: Th
www.w3schools.com
https://www.w3schools.com/sql/sql_and_or.asp
SQL AND, OR, NOT Operators
SQL AND, OR and NOT Operators The SQL AND, OR and NOT Operators The WHERE clause can be combined with AND, OR, and NOT operators. The AND and OR operators are used to filter records based on more than one condition: The AND operator displays a record if al
www.w3schools.com
3. 중성화 여부 파악하기
SELECT
animal_id,name,
case when sex_upon_intake like '%Neutered%' or sex_upon_intake like '%Spayed%' then 'O'
else 'X'
end as '중성화'
from animal_ins
왠지 앞으로 case when 구문을 많이 쓸 거 같다는 예감...
활용적인 측면에서 case when을 설명하자면, 생성되어져 있는 칼럼에 대해서,
내가 그것을 분석하고, 필요한 정보에 대해서 나만의 언어로 재가공할 수 있다는 점.