๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๋ฐ˜์‘ํ˜•

MySQL24

MySQL 11๋ฒˆ์งธ์ˆ˜์—… 4-1) ์‚ฌ์šฉ์ž ID๋ฅผ "SKY", ์•”ํ˜ธ(PASSWORD) "SKY1234"๋กœ ์ƒ์„ฑํ•˜์‹œ์˜ค. A) create user sky identified by 'sky1234'; โ€‹ โ€‹ 4-2) ์‚ฌ์šฉ์ž "SKY"์˜ ์•”ํ˜ธ๋ฅผ "SKY5678"๋กœ ๋ณ€๊ฒฝํ•˜์‹œ์˜ค. A) alter userโ€‹ sky identified with mysql_native_password by 'sky5678'; โ€‹ โ€‹ 4-3) ์‚ฌ์šฉ์ž "SKY"์—๊ฒŒ ๋ชจ๋“  ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๋Š” ๋ชจ๋“  ๊ถŒํ•œ์„ ๋ถ€์—ฌํ•˜์‹œ์˜ค. A) grant all privileges on *.* to sky; โ€‹ โ€‹ 4-4) ๋‹ค์Œ๊ณผ ๊ฐ™์€ ํ•™์ƒ์‹ ์ƒํ…Œ์ด๋ธ”(SINSANG)์ด ์žˆ๋‹ค. ํ•™๋ฒˆ:์ •์ˆ˜ 2์ž๋ฆฌ, ์ด๋ฆ„:์˜์ˆ˜์น˜ 10์ž๋ฆฌ, ์ถœ์ƒ๋…„๋„:์˜์ˆ˜์น˜ 4์ž๋ฆฌ, ์„ฑ๋ณ„:์˜์ˆ˜์น˜ 1์ž๋ฆฌ, ๋„์‹œ๋ช…:์˜์ˆ˜์น˜ .. 2021. 2. 8.
MySQL 10๋ฒˆ์งธ์ˆ˜์—… ์˜ˆ์ œ 5-1) ๊ณผ๋ชฉ๋ช…, ๊ณผ๋ชฉ ์ฝ”๋“œ, ๊ณผ๋ชฉ ์ธ์›, ๊ณผ๋ชฉ ๊ฐœ์„ค ์ผ์ž๋ฅผ ๊ธฐ๋กํ•˜๊ธฐ ์œ„ํ•œ diplomas ํ…Œ์ด๋ธ”์„ ์ƒ์„ฑํ•˜๋ผ. corse, student, end_date ์—ด์„ ์‚ฌ์šฉํ•˜์—ฌ ์กฐํ•ฉ ๊ธฐ๋ณธ ํ‚ค๋ฅผ ์ƒ์„ฑํ•œ๋‹ค. A) mysql> create table diplomas (course varchar(20) not null, student varchar(10) not null, cou_num int(2), end_date date not null, primary key(course, student, end_date)); โ€‹ -๊ธฐ๋ณธํ‚ค(PK) ์ง€์ •์ผ๋• ๊ตณ์ด not null์„ ์“ฐ์ง€์•Š์•„๋„ ๋จ -ํ…Œ์ด๋ธ”๋งˆ๋‹ค ๊ธฐ๋ณธํ‚ค๊ฐ€ ์žˆ๋Š”๊ฒŒ ์ข‹์Œ โ€‹ โ€‹โ€‹ ์˜ˆ์ œ 5-2) diplomas ํ…Œ์ด๋ธ”์— ๋‹ค์Œ์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์ž…๋ ฅํ•˜๋ผ. A) mysql> inse.. 2021. 2. 8.
MySQL 9๋ฒˆ์งธ ์ˆ˜์—… โ–ถ ๋ทฐ(Views) ์‚ฌ์šฉ์ž์—๊ฒŒ ๋ณด์—ฌ์ฃผ๊ธฐ ์œ„ํ•œ ๋ทฐ ์ „์šฉ ํ…Œ์ด๋ธ”. ๊ธฐ์–ต ๊ณต๊ฐ„์„ ์ฐจ์ง€ํ•˜์ง€๋Š” ์•Š๋Š”๋‹ค. ๊ฐ€์ƒ ํ…Œ์ด๋ธ”. ์˜ˆ์ œ 4-9) ํ•™์  ํ…Œ์ด๋ธ”์˜ ํ•™๋ฒˆ, ์ด๋ฆ„, ์ƒ๋…„์›”์ผ, ๋‚˜์ด๋ฅผ ์ถœ๋ ฅํ•˜๋ผ. -๋ทฐ ํ…Œ์ด๋ธ”์€ select๋ฌธ ๋ฐ–์— ๋ชป์”€ โ€‹ โ€‹โ€‹ ์˜ˆ์ œ 4-10) ํ•™์  ํ…Œ์ด๋ธ”์˜ ํ•™๋ฒˆ, ์ด๋ฆ„, ๋‚˜์ด๋กœ ๊ตฌ์„ฑ๋œ AGES ๋ทฐ ํ…Œ์ด๋ธ”์„ ์ƒ์„ฑํ•˜๋ผ. โ€‹ โ€‹ โ€‹ โ–ถ ๋ณด์•ˆ ์„ค์ • - ์Šˆํผ ์œ ์ €[Root] ํŒจ์Šค์›Œ๋“œ ๋ณ€๊ฒฝํ•˜๊ธฐ ์ฑ…์— ๋‚˜์˜ค๋Š” ๋ฐฉ๋ฒ•์€ ์ง€๊ธˆ version์—์„  ์ ์šฉ์ด ์•ˆ๋จ 2021. 2. 8.
MySQL 8๋ฒˆ์งธ์ˆ˜์—… โ–ถ ์งˆ์˜(Quary) ํ…Œ์ด๋ธ” โ€‹โ€‹ ์˜ˆ์ œ 4-1) STUDENT ํ…Œ์ด๋ธ”๋กœ๋ถ€ํ„ฐ ์„ฑ๋ณ„์ด ๋‚จ์ž์ธ ๊ฐ ํ•™์ƒ์˜ ํ•™๋ฒˆ, ์ด๋ฆ„, ์˜๋ฌธ์ด๋ฆ„, ํ•™๋…„, ์„ฑ๋ณ„์„ ์˜๋ฌธ ์ด๋ฆ„ ์ˆœ์„œ๋กœ ์ถœ๋ ฅํ•˜๋ผ. A) 1. ๋กœ๊ทธ์ธ ํ›„ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์„ ํƒ. 2. select stu_no, stu_name, stu_ename, grade, gender from student where gender = 1 or gender = 3 or gender = 5 order by stu_ename; -gender = 1 or gender = 3 or gender = 5 ๋ฅผ ํ•œ ๋ฌธ์žฅ์œผ๋กœ ์ค„์ผ ์ˆ˜ ์žˆ๋‹ค → gender % 2 = 1 → gender % 2 0 : ๊ฐ™์ง€์•Š๋‹ค๋Š” ๋œป → gender % 2 != 0 โ€‹ -order by stu_ename asc → ์˜ค๋ฆ„์ฐจ์ˆœ .. 2021. 2. 8.
[MySQL] ์†์œผ๋กœ ๋ช…๋ น์–ด ์“ฐ๊ธฐ ๋ฌธ์ œ 1) ์„œ์šธํŠน๋ณ„์‹œ์— ์‚ฌ๋Š” ์‚ฌ๋žŒ์˜ ๋ฐ์ดํ„ฐ ์กฐํšŒ A) mysql> select * from Address where Address1 = '์„œ์šธํŠน๋ณ„์‹œ'; (' ' ์ ๋Š”๊ฑฐ ๊ผญ ์žŠ์ง€๋ง๊ฒƒ) (select * from ํ…Œ์ด๋ธ”์ด๋ฆ„ : ํ…Œ์ด๋ธ”์˜ ์ „์ฒด ๋‚ด์šฉ์ด ์„ ํƒ๋จ) โ€‹ โ€‹ ๋ฌธ์ œ 2) ๊ฒฝ๊ธฐ๋„์— ์‚ฌ๋Š” ์‚ฌ๋žŒ์˜ Client_ID ์กฐํšŒ A) mysql> select Client_ID fromโ€‹ Address where Address1 = '๊ฒฝ๊ธฐ๋„'; โ€‹ ๋ฌธ์ œ 3) SEQ_ID๊ฐ€ 3 ์ด์ƒ์ธ ๋ฐ์ดํ„ฐ์˜ ์ฃผ์†Œ๋งŒ ์กฐํšŒ A) mysql> select Address1, Address2, Address3 from Address where SEQ_ID >= 3; โ€‹ โ€‹ ๋ฌธ์ œ 4) + ๋ฐ‘ ๋ฐ์ดํ„ฐ ์ถ”๊ฐ€ A) mysql> insert into A.. 2021. 2. 8.
MySQL 6๋ฒˆ์งธ์ˆ˜์—… โ–ถ ํ…Œ์ด๋ธ” ์ƒ์„ฑ ('haksa' ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋Š” ์ „์ฒด 9๊ฐœ์˜ ํ…Œ์ด๋ธ”๋กœ ๊ตฌ์„ฑ๋˜์–ด ์žˆ๊ณ , ํ…Œ์ด๋ธ”์„ ์ƒ์„ฑํ•˜๊ธฐ ์œ„ํ•ด์„œ create table ๋ช…๋ น๋ฌธ์„ ์ž…๋ ฅํ•œ๋‹ค.) โ–ถ mySQL Workbench์—์„œ table ์ž…๋ ฅํ•˜๊ธฐ 2021. 2. 7.
๋ฐ˜์‘ํ˜•