๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๐Ÿ“Š|DataBase2

[SQL] ์ŠคํŒŒ๋ฅดํƒ€ ์ฝ”๋”ฉํด๋Ÿฝ SQL - 1์ฃผ์ฐจ (select, where, ...) ๋ฐ์ดํ„ฐ ๋ฒ ์ด์Šค๋ž€? - ์—ฌ๋Ÿฌ ์‚ฌ๋žŒ๋“ค์ด ๊ฐ™์ด ์‚ฌ์šฉํ•˜๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ๋ชจ์œผ๋Š” ๊ณณ - ์‚ฌ์šฉ์ž๊ฐ€ ์›ํ•˜๋Š”๋Œ€๋กœ ํ™œ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ CRUD์˜ ๊ธฐ๋Šฅ์„ ์ง€์›ํ•œ๋‹ค ์ด ์ค‘ ์ŠคํŒŒ๋ฅดํƒ€ ๊ฐ•์˜์—์„œ๋Š” 'Read'์— ๋Œ€ํ•ด์„œ๋งŒ ๊ณต๋ถ€ํ•œ๋‹ค! SQL์ด๋ž€? - Structured Query Language ์˜ ์•ฝ์ž! - Query(์š”์ฒญ)๋ฅผ ๋‚ ๋ ค์„œ ์›ํ•˜๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ๊ฒƒ์„ ๋•๋Š” ์–ธ์–ด์ด๋‹ค. - ์ฆ‰, ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ๋ช…๋ น์–ด๋ฅผ ์ž‘์„ฑํ•˜๋Š” ๊ฒƒ์ด 'SQL ์ฟผ๋ฆฌ๋ฅผ ์ž‘์„ฑํ•œ๋‹ค' ๋ผ๊ณ  ํ•œ๋‹ค. SQL์ด ํ•„์š”ํ•œ ์ด์œ ? - ๋ฐ์ดํ„ฐ๋ฅผ Readํ•˜๋Š” ๊ณผ์ •์„ ๊ต‰์žฅํžˆ ๊ฐ„ํŽธํ•˜๊ฒŒ ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ด์ค€๋‹ค. - ๋ฐ์ดํ„ฐ ์ •๋ฆฌ ๋ฐ ๋ถ„์„ ๊ธฐ๋Šฅ์„ ์ง€์›ํ•œ๋‹ค. Select & Where - ๋ฐ์ดํ„ฐ๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๊ณ (select), ์กฐ๊ฑด์— ๋งž๊ฒŒ ํ•„ํ„ฐ๋ง(where)! Select select ์ฟผ๋ฆฌ๋ฌธ์ด๋ž€? ์ฟผ.. 2023. 2. 14.
[SQL] SQL ๋ฌธ๋ฒ• ์ •๋ฆฌ Show show tables; Select SELECT (ํ•„๋“œ) FROM (ํ…Œ์ด๋ธ”) ๋ชจ๋“  ํ•„๋“œ(*)๋ฅผ ๊ฐ€์ ธ์˜ค๋ฉด ์•„๋ž˜์™€ ๊ฐ™๋‹ค! SELECT * FROM users u ํŠน์ • ํ•„๋“œ๋ฅผ ๊ฐ€์ ธ์˜ค๋ฉด SELECT user_id , name FROM users u Where SELECT (ํ•„๋“œ) FROM (ํ…Œ์ด๋ธ”) WHERE (์กฐ๊ฑด) Where์ ˆ์˜ ์กฐ๊ฑด ๋ฌธ๋ฒ• 1) ๋“ฑํ˜ธ, ๋ถ€๋“ฑํ˜ธ ์กฐ๊ฑด =, !=, >, >= 2) ๋ฒ”์œ„ ์กฐ๊ฑด between ex) 20๋…„ 7์›”์— ๊ฐ€์ž…ํ•œ ์œ ์ € ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ค๊ธฐ SELECT * FROM users u WHERE created_at BETWEEN "2020-07-01" and "2020-08-01" 3) ํฌํ•จ ์กฐ๊ฑด in ex) ๊ฒฐ์ œ๋ฐฉ์‹์ด ์นด์นด์˜คํŽ˜์ด์™€ ์นด๋“œ์ธ ์ฃผ๋ฌธ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ค๊ธฐ SELECT orde.. 2023. 2. 12.
๋ฐ˜์‘ํ˜•