2023-01-10 [TIL]

jennaยท2023๋…„ 1์›” 11์ผ
0

TIL/WIL

๋ชฉ๋ก ๋ณด๊ธฐ
9/60

๐Ÿ’ก์˜ค๋Š˜ ํ•œ ๊ฒƒ

mysql

show databases;

use [DATABASE ์ด๋ฆ„];

select * from [TABLE ์ด๋ฆ„]; //ํ•ด๋‹น ํ…Œ์ด๋ธ” ์กฐํšŒ
=> Empty set(๋น„์–ด์žˆ์Œ)

show create table post;

insert into [TABLE ์ด๋ฆ„] ([์ปฌ๋Ÿผ๋ช…1], [์ปฌ๋Ÿผ๋ช…2], [์ปฌ๋Ÿผ๋ช…3]...) values([์ปฌ๋Ÿผ1๊ฐ’], [์ปฌ๋Ÿผ2๊ฐ’], ์ปฌ๋Ÿผ3๊ฐ’]...);

select * from [TABLE ์ด๋ฆ„];

sselect * from [TABLE ์ด๋ฆ„] \G;

select * from [TABLE ์ด๋ฆ„] where writer = 'a"??

update [TABLE ์ด๋ฆ„] set [์ปฌ๋Ÿผ๋ช…] = [๋ฐ”๊ฟ€ ์ปฌ๋Ÿผ๊ฐ’] where id = [id ๋„˜๋ฒ„];
//ํ•ด๋‹น id์˜ ํ•ด๋‹น ์ปฌ๋Ÿผ๋ช…์— ๊ฐ’์„ ๋ฐ”๊ฟˆ
ex)
update post set read_count = read_count + 1 where id = 5;

delete from [TABLE ์ด๋ฆ„] where id = [id ๋„˜๋ฒ„];
//ํ•ด๋‹น ํ…Œ์ด๋ธ”์— ๋ช‡๋ฒˆ์งธ id๋ฅผ ์ง€์šด๋‹ค
profile
https://github.com/jennaaaaaaaaa

0๊ฐœ์˜ ๋Œ“๊ธ€