SQL ์ •๋ฆฌ

[์›๋ณธ ๋งํฌ]

๊ธฐ๋ณธ ๋ฐ์ดํ„ฐ ์ œ์–ด

์‚ฝ์ž…
insert into ํ…Œ์ด๋ธ”๋ช…(์†์„ฑ๋ช…๋“ค...) values(๊ฐ’๋“ค...)

์ˆ˜์ •
update ํ…Œ์ด๋ธ”๋ช… set ์†์„ฑ๋ช…=๊ฐ’, ... where ์กฐ๊ฑด๋ฌธ

์‚ญ์ œ
delete from ํ…Œ์ด๋ธ”๋ช… where ์กฐ๊ฑด๋ฌธ

๊ฒ€์ƒ‰
select ์†์„ฑ๋ช…... from ํ…Œ์ด๋ธ”๋ช… where ์กฐ๊ฑด๋ฌธ


ํ…Œ์ด๋ธ” ์ƒ์„ฑ/์‚ญ์ œ
create table ํ…Œ์ด๋ธ”๋ช…(...)
drop table ํ…Œ์ด๋ธ”๋ช…

๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์ƒ์„ฑ/์‚ญ์ œ
create database ๋””๋น„๋ช…
drop database ๋””๋น„๋ช…


ํ…Œ์ด๋ธ”์— ์†์„ฑ ์ถ”๊ฐ€/์‚ญ์ œ
alter table ํ…Œ์ด๋ธ”๋ช… add ์†์„ฑ๋‚ด์šฉ...
alter table ํ…Œ์ด๋ธ”๋ช… drop column ์†์„ฑ๋ช…



๋ณตํ•ฉ ์กฐ๊ฑด๋ฌธ(if-else)
case //์‹œ์ž‘
when ์กฐ๊ฑด์‹ then ๋ฐ˜ํ™˜์‹
when ์กฐ๊ฑด์‹ then ๋ฐ˜ํ™˜์‹
...
else ๋ฐ˜ํ™˜์‹
end //๋