데이터 쿼리잉
SELECT : 칼럼, 계산값
FROM : 테이블명
우선 use 사용할데이터시트이름; 으로 파일을 선택
select phone : phone 칼럼을 선택한다..
from customer 테이블.
데이터 정렬
ORDER BY : 데이터값을 규칙에 따라 정렬
select 칼럼
from 테이블
order by
칼럼명 asc; (오름차순,) 혹은 desc(내림차순)
데이터 필터링
- WHERE – learn how to use the WHERE clause to filter rows based on specified conditions.
- 검색 조건을 부여 . and, or, not, TRUE, FALSE, UNKNOWN
city = nyc 검색
city = nyc and state = ny 검색
- SELECT DISTINCT – show you how to use the DISTINCT operator in the SELECT statement to eliminate duplicate rows in a result set.
- 중복을 제거하는 키
- AND – introduce you to the AND operator to combine Boolean expressions to form a complex condition for filtering data.
- 부울 표현식을 결합하여 데이터 필터링을 위한 복잡한 조건을 형성한다
- SELECT
customername,
country,
state
FROM
customers
WHERE
country = 'USA' AND
state = 'CA';
- OR– introduce you to the OR operator and show you how to combine the OR operator with the AND operator to filter data.
- IN – show you how to use the IN operator in the WHERE clause to determine if a value matches any value in a set.
- NOT IN – negate the IN operator using the NOT operator to check if a value doesn’t match any value in a set.
- BETWEEN – show you how to query data based on a range using the BETWEEN operator.
- LIKE – query database on pattern matching using wildcards such as % and _.
- LIMIT – use LIMIT to limit the number of rows returned by the SELECT statement
- IS NULL – test whether a value is NULL or not by using the IS NULL operator.