기본 사칙 연산이 select 에서 가능하다
select 33-30
from 이 select 보다 먼저 실행 된다, 영어 순서를 생각하면 이해하기에 좀더 편하다
SELECT nameFirst as name, nameLast, birthYear, birthCountry
FROM players
WHERE birthYear = 1974 OR birthCountry ='USA'
SELECT nameFirst as name, nameLast, birthYear
FROM players
where birthYear != 1866
요소에 null 이 있는 경우는 is null
null 이 없는 경우만 볼려면 is not null 로 조건을 넣어주면 된다
select *
from players
where deathYear is not null
select *
from players
where deathYear is null
반응형
'서버(Server) > DB' 카테고리의 다른 글
DB 쿼리로 나이 구하기와 각종 DB 에서 제공되는 수학 함수들 (0) | 2023.01.27 |
---|---|
DB : ORDER BY 와 게임 랭킹 구하기, top, offset (0) | 2023.01.26 |
DB : 패턴 매칭 (0) | 2023.01.25 |
DB : SQL Server 2022 download (0) | 2023.01.24 |
DB : SQL Server Management Studio, DB 야구 예제 (0) | 2023.01.24 |