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

IT/Database8

[Database] HeidiSQL ํ•จ์ˆ˜ In, Replace, Select, nvl, ๋‚ ์งœ ํ•จ์ˆ˜ ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์„ธ๊ณ„๋ฅผ ํƒ๊ตฌํ•ฉ์‹œ๋‹ค. [ ์กฐ๊ฑด ] -- [๋ฌธ์ œ] -- ์ƒํ’ˆ๋ถ„๋ฅ˜๋ช…์— ์ปดํ“จํ„ฐ๊ฐ€ ํฌํ•จ๋˜์–ด ์žˆ๊ณ , -- ์ฃผ๋ฌธ์ด๋ ฅ์ด ์žˆ๋Š” ์ƒํ’ˆ์— ๋Œ€ํ•œ ๋ฐ์ดํ„ฐ๋ฅผ ์กฐํšŒํ•˜๋ ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค. -- ์ƒํ’ˆ๋ช…, ์ƒํ’ˆ๋ถ„๋ฅ˜๋ช… ์กฐํšŒํ•˜๊ธฐ [ ์ž‘์„ฑ ์ฝ”๋“œ ] SELECT Prod_name, (select Lprod_nm FROM lprod WHERE lprod_gu=prod_lgu) AS lprod_nm FROM prod WHERE prod_lgu IN (SELECT lprod_gu FROM lprod WHERE lprod_nm LIKE '%์ปดํ“จํ„ฐ%') AND prod_id IN (SELECT cart_prod FROM cart); [ ๊ฒฐ๊ณผ ] 1. Replace ํ•จ์ˆ˜ ์น˜ํ™˜ํ•˜๊ธฐ replace(์›๋ณธ๊ฐ’, ์ฐพ์„ ๊ฐ’, ๋ฐ”๊ฟ€ ๊ฐ’) [ ํ™œ์šฉ ์˜ˆ์‹œ ] -- R.. 2023. 11. 25.
[Database] Heidi SQL ๋ฌธ์ž์—ดํ•จ์ˆ˜, Select, From, Where, ๋ณ„์นญ ์‚ฌ์šฉ, ์ •๋ ฌ, ์—ฐ์‚ฐ์ž, ๋‚ ์งœ ํ˜•์‹, ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ ์ˆœ์„œ ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์„ธ๊ณ„๋ฅผ ํƒ๊ตฌํ•ฉ์‹œ๋‹ค. ํšŒ์› ํ…Œ์ด๋ธ” ์ „์ฒด ์กฐํšŒํ•˜๊ธฐ SELECT * FROM member; ๋ณ„์นญ์„ ์‚ฌ์šฉํ•˜๋Š” ์ด์œ  ๊ธด ๋‹จ์–ด๋ฅผ ์ค„์—ฌ์„œ ์‚ฌ์šฉํ•˜๋Š”๋ฐ ์ข‹๋‹ค. SQL์—์„œ ๋ณ„์นญ์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ๊ณณ - ์ปฌ๋Ÿผ๋ช… ๋Œ€์‹  ๋ณ„์นญ ์‚ฌ์šฉ ์˜ˆ์‹œ) mem_id as id - ํ…Œ์ด๋ธ”๋ช… ๋Œ€์‹  ๋ณ„์นญ ์‚ฌ์šฉ ์˜ˆ์‹œ) From member mem -- ํšŒ์›์˜ ๋งˆ์ผ๋ฆฌ์ง€ ๊ฐ’์ด 10 ์ด์ƒ์ธ ๋ฐ์ดํ„ฐ๋งŒ ์กฐํšŒํ•˜๊ธฐ -- ์กฐํšŒ์ปฌ๋Ÿผ์€ ํšŒ์›์•„์ด๋””, ํšŒ์›์ด๋ฆ„, ๋งˆ์ผ๋ฆฌ์ง€ -- ๋ณ„์นญ, id, name, point -- ์‚ฌ์šฉํ•  ํ…Œ์ด๋ธ”๋ช… : member -- ์‚ฌ์šฉํ•  ์ปฌ๋Ÿผ๋ช… : mem_mileage, mem_id, mem_name -- ์กฐ๊ฑด์ด ๋ฌด์—‡์ธ์ง€ : mem_mileage >= 10 SELECT mem_mileage AS point, mem_id AS id, me.. 2023. 11. 24.
[Database] HeidiSQL CRUD ๋ฐ์ดํ„ฐ ์ž…๋ ฅ, ์ˆ˜์ •, ์‚ญ์ œ, ์กฐํšŒ ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์„ธ๊ณ„๋ฅผ ํƒ๊ตฌํ•ฉ์‹œ๋‹ค. HeidiSQL์„ ํ™œ์šฉํ•˜์—ฌ CRUD (๋ฐ์ดํ„ฐ ์ž…๋ ฅ, ์ˆ˜์ •, ์‚ญ์ œ, ์กฐํšŒ)๋ฅผ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. HeidiSQL์€ ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•  ๋•Œ ๋Œ€๋ฌธ์ž, ์†Œ๋ฌธ์ž ๊ตฌ๋ถ„์ด ์—†์Šต๋‹ˆ๋‹ค. ๋˜ํ•œ ๋“ค์—ฌ์“ฐ๊ธฐ๋„ ๊ตฌ๋ถ„์ด ์—†์œผ๋ฏ€๋กœ ์ž์œ ๋กญ๊ฒŒ ์ž‘์„ฑํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค. HeidiSQL์˜ ์ „์ฒด ์‹คํ–‰ ๋‹จ์ถ•ํ‚ค๋Š” F9์ด๊ณ , ํ˜„์žฌ ์ฟผ๋ฆฌ ์‹คํ–‰ ๋‹จ์ถ•ํ‚ค๋Š” Shift + Ctrl + F9์ž…๋‹ˆ๋‹ค. ๋ฐ์ดํ„ฐ ์ž…๋ ฅ INSERT INTO ํ…Œ์ด๋ธ”๋ช…(์ปฌ๋Ÿผ๋ช…1, ...์ปฌ๋Ÿผ๋ช…N) VALUES (๊ฐ’1, ...๊ฐ’N) ๋ฐ์ดํ„ฐ ์ˆ˜์ • Update ํ…Œ์ด๋ธ”๋ช… Set ์ˆ˜์ •ํ• ์ปฌ๋Ÿผ๋ช…1 = ์ˆ˜์ •ํ• ๊ฐ’, ์ˆ˜์ •ํ• ์ปฌ๋Ÿผ๋ช…2 = ์ˆ˜์ •ํ• ๊ฐ’ Where ์กฐ๊ฑด ์ œ์‹œ...(๋ฌด์กฐ๊ฑด) ๋ฐ์ดํ„ฐ ์‚ญ์ œ Delete From ํ…Œ์ด๋ธ”๋ช… Where ์‚ญ์ œ ์กฐ๊ฑด ์ œ์‹œ...(๋ฌด์กฐ๊ฑด) ์กฐํšŒ Select ์กฐํšŒ.. 2023. 11. 23.
[Database] ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค_๊ฐœ์š” (Maria DB ์„ค์น˜ ๋ฐฉ๋ฒ•, HeidiSQL ํ™œ์šฉ) ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์„ธ๊ณ„๋ฅผ ํƒ๊ตฌํ•ฉ์‹œ๋‹ค * ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค - ๋ฐ์ดํ„ฐ๋ฅผ ๊ด€๋ฆฌํ•˜๋Š” ๊ณณ * DBMS : ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ๊ด€๋ฆฌ ์‹œ์Šคํ…œ * RDBMS : ๊ด€๊ณ„ํ˜• ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ๊ด€๋ฆฌ ์‹œ์Šคํ…œ * DB Server : DB(DBMS or RDBMS ๊ฐ™์€ ์˜๋ฏธ๋กœ ์‚ฌ์šฉ๋จ)๊ฐ€ ๊ตฌ์ถ•๋œ ์‹œ์Šคํ…œ์„ ์˜๋ฏธํ•จ * RDBMS - Oracle : ์˜ค๋ผํด, ์ตœ์ ํ™” os๋Š” ๋ฆฌ๋ˆ…์Šค, ๋‹ค๋งŒ ๋ชจ๋“  os์— ๋‹ค ์•ˆ์ •ํ™”๋˜์–ด ์žˆ์Œ - MySQL : ์˜ค๋ผํด, ์ตœ์ ํ™” os๋Š” ๋ฆฌ๋ˆ…์Šค, ๋‹ค๋งŒ ๋ชจ๋“  os์— ๋‹ค ์•ˆ์ •ํ™”๋˜์–ด ์žˆ์Œ - MS - SQL : ๋งˆ์ดํฌ๋กœ์†Œํ”„ํŠธ, ์ตœ์ ํ™” os๋Š” ์œˆ๋„์šฐ - MariaDB : ์˜คํ”ˆ์†Œ์Šค๊ธฐ๋ฐ˜ DB, ์ตœ์ ํ™” os๋Š” ๋ฆฌ๋ˆ…์Šค, ๋‹ค๋งŒ ๋ชจ๋“  os์— ๋‹ค ์•ˆ์ •ํ™”๋˜์–ด ์žˆ์Œ *MariaDB Server ์„ค์น˜ - Download URL https://mariadb.org.. 2023. 11. 22.

loading