DML(CRUD)
-insert
-select
- like
- in
- between
- distinct
- count(distinct col1)
- order by, rand()
- order by col1 is null ASC, col1 ASC
- limit a, limit a,b
- group by, having
- case when ~else ~end
- on duplicate key update... : unique한 키를 가진 컬럼을 duplicate 시킨다
- join
- inner join
- outer join
- left outer join
- right outer join
- full outer join :mysql에서는 없기때문에 left outer join과 right outer join을 union걸어서 사용한다.
- cross join : 카르테시안곱이 나온다 (select * from dept, emp) 실무에서는 존재하지 않는다
-update
-delete
order by를 rand()주게되면 불규칙하게 나오게 할 수 있다.
TCL : Commit & Rollback
"Session단위로 Tx는 제어됨"
start transanction; 하면 트랜젝션이 시작됨 (commit이나 rollback까지 유효)
DDL은 트랜젝션의 대상이 아니다(항상 오토커밋이 된다.)
save point a;로 트랜잭션의 롤백포인트를 만들수있다.
'SeSac (2021-08 ~ 2021-12) > MySQL' 카테고리의 다른 글
MySQL - 유용한 내장 함수들 (0) | 2021.09.05 |
---|---|
MySQL - SQL 한방에 정리하기 Part 1 - DCL, DDL (0) | 2021.08.31 |
MySQL 13 (마지막) - Backup & Restore (0) | 2021.08.31 |
MySQL 11 - Cursor를 이용한 프로시저 작성 (0) | 2021.08.30 |
MySQL 10 - Stored Function & Procedure (0) | 2021.08.30 |