Search

5 : Intermediate SQL

course
last review
2023/04/15
mastery
ranger
progress
not started
date
2023/03/21
4 more properties
Previous chapter

Join Expressions

Joined Relations

๋‘ Relation์„ ๊ฐ€์ง€๊ณ  ๋˜๋‹ค๋ฅธ Relation์„ ์ฐฝ์ถœํ•˜๋Š” ์˜คํผ๋ ˆ์ดํ„ฐ
โ€ข
2๊ฐœ ์ด์ƒ์˜ ํ…Œ์ด๋ธ”๋กœ๋ถ€ํ„ฐ rows๋ฅผ ์กฐํ•ฉํ•œ๋‹ค.
โ€ข
Natural Join
โ€ข
Inner join
โ€ข
Outer Join

Natural Join in SQL

select name, course_id from students, takes where student.ID = takes.ID;
SQL
๋ณต์‚ฌ
๋‹ค์Œ ์ฟผ๋ฆฌ์™€ ๊ฐ™๋‹ค.
select name, course_id from student natural join takes
SQL
๋ณต์‚ฌ
์ผ๋ฐ˜ํ™”ํ•˜๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค.
select A1, A2, An from r1 natural join r2 ... natural join rn where P;
SQL
๋ณต์‚ฌ
attribute์˜ name์„ ์ฒดํฌํ•˜์—ฌ ๋™์ผํ•œ ํ•ญ๋ชฉ์ด ์žˆ๋Š”์ง€ ์ฒดํฌํ•œ๋‹ค.
name์„ ์ฒดํฌ

Danger in Natural Join

๋™์ผํ•œ attribute name์„ ๋ชจ๋‘ ์ฒดํฌํ•˜๊ธฐ ๋•Œ๋ฌธ์— ํŠน์ • ์กฐ๊ฑด๋งŒ ์ฒดํฌํ•˜๊ณ  ์‹ถ์€ ๊ฒฝ์šฐ ์˜๋„ํ•˜์ง€ ์•Š์€ ์ •๋ณด๊ฐ€ ์ถœ๋ ฅ๋  ์ˆ˜ ์žˆ๋‹ค.
select name, title from student natural join takes natural join course;
SQL
๋ณต์‚ฌ
student์™€ takes๊ฐ„ natural join์„ ์ง„ํ–‰ํ•œ relation์— course๋ฅผ natural join์„ ์ง„ํ–‰ํ•˜๋ฉด course_id์™€ dept_name ๋ชจ๋‘ ์ฒดํฌ๊ฐ€ ๋œ๋‹ค.
๋ชจ๋“  ๊ณตํ†ต๋œ attribute๊ฐ„ ์ผ์น˜ํ•˜๋Š”๊ฒŒ ์žˆ๋Š”์ง€ ์ฒดํฌํ•˜๊ธฐ ๋•Œ๋ฌธ์— course_id๋งŒ ๊ฐ™์€๊ฒŒ ์žˆ๋Š”์ง€ ์ฒดํฌํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด ์•„๋ž˜์™€ ๊ฐ™์ด ์ฝ”๋“œ๋ฅผ ์งœ์•ผํ•œ๋‹ค.
select name, title from student natural join takes, course where takes.course_id = course.course_id;
SQL
๋ณต์‚ฌ

Natural Join with Using Clause

using ํ‚ค์›Œ๋“œ๋ฅผ ์‚ฌ์šฉํ•ด์„œ ํŠน์ • attribute๋ฅผ ์ง€์ •ํ•ด์ค„ ์ˆ˜ ์žˆ๋‹ค. (using์ด ์—†๋‹ค๋ฉด default option)
select name, title from (student natural join takes) natural join course using (course_id)
SQL
๋ณต์‚ฌ

Join Conditions

โ€ข
on : Inner Join
select * from student join takes on (student_ID = takes_ID)
SQL
๋ณต์‚ฌ
on ํ‚ค์›Œ๋“œ๋ฅผ ์‚ฌ์šฉํ•œ ์œ„ ์ฝ”๋“œ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค.
select * from student, takes where student_ID = takes_ID;
SQL
๋ณต์‚ฌ
inner Join์€ ์กฐ๊ฑด์— ํ•ด๋‹นํ•˜์ง€ ์•Š์œผ๋ฉด ๋ฒ„๋ ค์ง„๋‹ค.
4์™€ e๊ฐ€ t2์— ์—†๊ธฐ ๋•Œ๋ฌธ์— ๋ฒ„๋ ค์ง„

Outer Join

๋ณด์กดํ•˜๊ณ  ์‹ถ์€ ๋ฐ์ดํ„ฐ๋ฅผ ๋ณด์กดํ•˜๋Š” ํ˜•ํƒœ.
๋นˆ ๋ฐ์ดํ„ฐ๋Š” null๊ฐ’์„ ๊ธฐ๋ณธ์œผ๋กœ ์“ด๋‹ค.

Left Outer Join

Right Outer Join

Full Outer Join

Join Types and Conditions

Join Condition

โ€ข
๋‘ relations์—์„œ ์–ด๋–ค tuples๊ฐ€ ๋งค์นญ๋˜๊ฒŒ ํ•  ์ง€ ์ •์˜

Join types

โ€ข
ordering Issues??? ๋‹ค์Œ์‹œ๊ฐ„์— ๊ณ„์†โ€ฆ..

View

View Definitions and Use

instructor์˜ ์ •๋ณด๋Š”๋Š” ํ•„์š”ํ•˜์ง€๋งŒ ๊ทธ ์ค‘ salary ์ •๋ณด๋Š” ํ•„์š”ํ•˜์ง€ ์•Š์€ ์‚ฌ๋žŒ์„ ์ƒ๊ฐํ•ด๋ณด์ž.
salary ์—†์ด instructor์˜ View๋ฅผ ์ƒ์„ฑ
create view faculty as select ID, name, dept_name from instructor
SQL
๋ณต์‚ฌ
Biology Department์˜ instructor์„ ๋ชจ๋‘ ์„ ํƒ
select name from faculty where dept_name = 'Biologyโ€˜
SQL
๋ณต์‚ฌ
Department Salary Total์˜ View๋ฅผ ์ƒ์„ฑ
create view departments_total_salary(dept_name, total_salary) as select dept_name, sum (salary) from instructor group by dept_name;
SQL
๋ณต์‚ฌ

Using Other Views

v2๋ผ๋Š” View๋ฅผ ๋งŒ๋“ค๊ณ  v2๋กœ๋ถ€ํ„ฐ ์ƒˆ๋กœ์šด View v1์„ ๋ฝ‘์•„๋‚ด๊ณ  ์‹ถ๋‹ค๊ณ  ํ•  ๋•Œ, v1์€ v2์— ์ง์ ‘์ ์œผ๋กœ ์˜์กด๋œ๋‹ค(depend directly)๊ณ  ํ•œ๋‹ค.
create view physics_fall_2017 as select course.course_id, sec_id, building, room_number from course, section where course.course_id = section.course_id and course.dept_name = 'Physics' and section.semester = 'Fall' and section.year = '2017โ€™;
SQL
๋ณต์‚ฌ
create view physics_fall_2017_watson as select course_id, room_number from physics_fall_2017 where building= 'Watson';
SQL
๋ณต์‚ฌ
physics_fall_2017_watson์€ physics_fall_2017์— depend directlyํ•œ๋‹ค.
์•„๊นŒ view๋Š” ์ผ์ข…์˜ ์„œ๋ธŒ์ฟผ๋ฆฌ โ†’ ๋ณ€์ˆ˜ํ™”์— ๊ฐ€๊น๋‹ค๊ณ  ํ–ˆ๋Š”๋ฐ ์œ„ ์ฝ”๋“œ๋ฅผ ์•„๋ž˜์™€ ๊ฐ™์ด ๋ฐ”๊ฟ€ ์ˆ˜ ์žˆ์„ ๊ฒƒ์ด๋‹ค.
create view physics_fall_2017_watson as select course_id, room_number from (select course.course_id, building, room_number from course, section where course.course_id = section.course_id and course.dept_name = 'Physics' and section.semester = 'Fall' and section.year = '2017') where building= 'Watson';
SQL
๋ณต์‚ฌ
๋”ฐ๋ผ์„œ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋ณ€ํ™˜๋  ์ˆ˜ ์žˆ์„ ๊ฒƒ์ด๋‹ค.
repeat e(1)์•ˆ์— relation v(i)๋ฅผ ์ฐพ์•„๋ผ v(i)๋ฅผ ์ •์˜ํ•˜๋Š” ๊ฒƒ์œผ๋กœ v(i)๋ฅผ ๋Œ€์ฒดํ•ด๋ผ until e1์— View๊ฐ€ ๋”์ด์ƒ ์—†์„๋•Œ๊นŒ์ง€
SQL
๋ณต์‚ฌ

Materialized Views

์ž„์‹œ์ ์œผ๋กœ View๋ฅผ ์ €์žฅํ•˜๊ฒ ๋‹ค! View๋“ค์ด ๋งŽ์ด ์“ฐ์ผ ๊ฒƒ์ด๊ณ , select๋ฌธ์ด ์˜ค๋ฒ„ํ—ค๋“œ๊ฐ€ ํฌ๋‹ค๊ณ  ํŒ๋‹จํ•˜๋Š” ๊ฒฝ์šฐ ๋ฉ”๋ชจ๋ฆฌ๋‚˜ ์Šคํ† ๋ฆฌ์ง€์— ์ €์žฅ๋˜๋Š” ๊ฒฝ์šฐ๋„ ์žˆ์Œ.
๋‹จ, Materialized Views๋Š” ๋ณธ์ฒด Relation์ด ์—…๋ฐ์ดํŠธ๊ฐ€ ๋˜๋ฉด ์ •๋ณด๊ฐ€ ์—…๋ฐ์ดํŠธ๊ฐ€ ์ž๋™์œผ๋กœ ๋˜์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์—, ๋ณธ์ฒด Relation์ด ์—…๋ฐ์ดํŠธ ๋  ๋•Œ๋งˆ๋‹ค View๋ฅผ ์—…๋ฐ์ดํŠธํ•ด์„œ ์œ ์ง€๋ณด์ˆ˜๋ฅผ ํ•ด์ค˜์•ผ ํ•œ๋‹ค. ์ด์ œ Update์˜ ๋ฐฉ๋ฒ•์„ ์ž.

Update of a View

instructor๋กœ๋ถ€ํ„ฐ ๋น„๋กฏ๋œ faculty View์— ์ƒˆ๋กœ์šด tuple์„ ๋„ฃ๋Š”๋‹ค๊ณ  ๊ฐ€์ •ํ•˜์ž.
insert into faculty values('30765'm 'Green', 'Mist');
SQL
๋ณต์‚ฌ
๋‘ ๊ฐ€์ง€ ๋ฐฉ๋ฒ•์ด ์žˆ์„ ๊ฒƒ์ด๋‹ค.

Some Updates Cannot be Translated Uniquely

create view instructor_info as select ID, name, building from instructor, department where instructor.dept_name= department.dept_name;
SQL
๋ณต์‚ฌ
insert into instructor_info values ('69987', 'White', 'Taylor');
SQL
๋ณต์‚ฌ
์œ„์—์„œ ๋ณด๋ฉด instructor์™€ department์— dept_name์ด ๊ฐ™์€ ๊ฒƒ์„ ํ™•์ธํ•˜๊ณ  View๋ฅผ ์งฐ๋‹ค.
dept_name

And Some Not at All

View Updates in SQL

๋”ฐ๋ผ์„œ SQL์—์„œ View ์—…๋ฐ์ดํŠธ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฒฝ์šฐ์—๋งŒ ํ—ˆ๋ฝํ•˜๋„๋ก ํ•œ๋‹ค.
๊ทธ๋ƒฅ View๋Š” ์ฝ๋Š” ์šฉ๋„๋กœ๋งŒ ์“ฐ์ž.

Transaction

์—ฌ๋Ÿฌ๊ฐœ์˜ ์—ฐ์‚ฐ์„ ํ•˜๋‚˜์˜ ์—ฐ์‚ฐ์œผ๋กœ ์ทจ๊ธ‰ํ•˜๋Š” ์นœ๊ตฌ
begin; op1; op2; commit;
SQL
๋ณต์‚ฌ
์ด๋•Œ ๋‘ ์˜คํผ๋ ˆ์ด์…˜์ด ๋ชจ๋‘ ์ž˜ ์‹คํ–‰๋˜๋˜๊ฐ€, ๋‘˜ ๋ชจ๋‘ reject๋˜๊ณ  ๋๋‚˜๋˜๊ฐ€๋ฅผ ๋ณด์žฅํ•œ๋‹ค.
๋”ฐ๋ผ์„œ Transaction์€ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์ƒํƒœ์ค‘ ํ•˜๋‚˜๋กœ ๋ชจ๋‘ ๋๋‚˜์•ผ ํ•œ๋‹ค.
๊ฒฐ๊ตญ Transaction์€ Atomicํ•˜์—ฌ์•ผ ํ•œ๋‹ค.
โ€ข
๋ชจ๋‘ ์™„๋ฃŒ๋˜๊ฑฐ๋‚˜ ๋กค๋ฐฑํ•˜์—ฌ ์ ˆ๋Œ€๋กœ ์ผ์–ด๋‚˜์ง€ ์•Š์€ ๊ฒƒ ์ฒ˜๋Ÿผ ํ•ด์•ผ ํ•œ๋‹ค.
Transactions์˜ Isolation

Integrity Constraint

Constraints on a Single Relation

โ€ข
not null
โ€ข
primary key
โ€ข
unique
โ€ข
check(P)

Not Null Constraints

name varchar(20) not null budget numeric(12,2) not null
SQL
๋ณต์‚ฌ

Unique Constraints

The Check Clause

create table section (course_id varchar (8), sec_id varchar (8), semester varchar (6), year numeric (4,0), building varchar (15), room_number varchar (7), time slot id varchar (4), primary key (course_id, sec_id, semester, year), check (semester in ('Fall', 'Winter', 'Spring', 'Summer')))
SQL
๋ณต์‚ฌ

Referential Integrity

????????????

Cascading Actions in Referential Integrity

create table course ( (โ€ฆ dept_name varchar(20), foreign key (dept_name) references department on delete cascade on update cascade, . . .)
SQL
๋ณต์‚ฌ
cascade๋Œ€์‹  set null์ด๋‚˜ set default ๊ฐ’์œผ๋กœ ์„ค์ •๋  ์ˆ˜๋„ ์žˆ๋‹ค.

Integrity Constraint Violation During Transactions

create table person ( ID char(10), name char(40), mother char(10), father char(10), primary key ID, foreign key father references person, foreign key mother references person)
SQL
๋ณต์‚ฌ
constraint violation์—†์ด tuple insert๋ฅผ ํ•˜๋ ค๋ฉด ์–ด๋–ป๊ฒŒ ํ•ด์•ผํ•˜๋Š”๊ฐ€?
โ€ข
father, mother์„ null๊ธฐ๋ณธ๊ฐ’์œผ๋กœ ์„ค์ •ํ•˜๊ณ  ๋ชจ๋“  ์‚ฌ๋žŒ์„ ๋„ฃ์€ ๋’ค ์—…๋ฐ์ดํŠธ ํ•˜๋ฉด ๋œ๋‹ค.

Complex Check Conditions

Assertions

SQL Data Types and Schemas

Built-in Data Types in SQL

โ€ข
date : โ€˜yyyy-mm-ddโ€™
โ€ข
time : โ€˜HH:MM:SSโ€™
โ€ข
timestamp : date + time
โ€ข
interval ์‹œ๊ฐ„์˜ ๊ฐ„๊ฒฉ โ€˜1โ€™ day

Large-Object Types

ํฐ ํŒŒ์ผ์€ large-object๋กœ ๊ตฌ์„ฑํ•œ๋‹ค.
ํŒŒ์ผ์˜ ํฌ๊ธฐ๊ฐ€ ๋„ˆ๋ฌด ํฌ๋‹ค๋ฉด ์Šคํ† ๋ฆฌ์ง€์— ๋”ฐ๋กœ ์ €์žฅํ•ด๋†“๊ณ  ์œ„์น˜๋ฅผ ์ง€์ •ํ•ด์ฃผ๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ๋‹ค.

User-Defined Types

create type Dollars as numeric (12,2) final
SQL
๋ณต์‚ฌ
create table department (dept_name varchar(20), building varchar (15), budget Dollars);
SQL
๋ณต์‚ฌ

Domains

create domain person_name char(20) not null
SQL
๋ณต์‚ฌ
example:
create domain degree_level varchar(10) constraint degree_level_test check (value in ('Bachelors', 'Masters', 'Doctorate'));
SQL
๋ณต์‚ฌ

Index Creation

Authorization

๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์ผ๋ถ€์— ๋Œ€ํ•œ ์—ฌ๋Ÿฌ ํ˜•ํƒœ์˜ ๊ถŒํ•œ์„ ์‚ฌ์šฉ์ž์—๊ฒŒ ํ• ๋‹นํ•  ์ˆ˜ ์žˆ๋‹ค.
โ€ข
Read - ๋ฐ์ดํ„ฐ๋ฅผ ์ฝ์„ ๊ถŒํ•œ (reading ๊ฐ€๋Šฅ, modification์€ ๋ถˆ๊ฐ€๋Šฅ)
โ€ข
Insert - ์ƒˆ๋กœ์šด ๋ฐ์ดํ„ฐ๋ฅผ ์‚ฝ์ž…ํ•  ๊ถŒํ•œ (Insert ๊ฐ€๋Šฅ, modification์€ ๋ถˆ๊ฐ€๋Šฅ)
โ€ข
Update - ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐฑ์‹ ํ•  ๊ถŒํ•œ (modification ๊ฐ€๋Šฅ, delete๋Š” ๋ถˆ๊ฐ€๋Šฅ)
โ€ข
Delete - ๋ฐ์ดํ„ฐ๋ฅผ ์‚ญ์ œํ•  ๊ถŒํ•œ.
์ด๋Ÿฐ ์œ ํ˜•์˜ ๊ถŒํ•œ์„ ํŠน๊ถŒ(privilege)๋ผ ๋ถ€๋ฅธ๋‹ค.
๋ฆด๋ ˆ์ด์…˜์ด๋‚˜ ๋ทฐ์™€ ๊ฐ™์€ DB ์ผ๋ถ€์— ์ด๋Ÿฐ ์œ ํ˜•์˜ privilege๋ฅผ
์ „์ฒด ์‚ฌ์šฉ์ž์—๊ฒŒ ๋ถ€์—ฌํ•˜๊ฑฐ๋‚˜
๋ถ€์—ฌํ•˜์ง€ ์•Š๊ฑฐ๋‚˜(๊ธˆ์ง€ํ•˜๊ฑฐ๋‚˜)
์ผ๋ถ€๋งŒ ๋ถ€์—ฌํ•  ์ˆ˜ ์žˆ๋‹ค.
๋ฐ์ดํ„ฐ์— ๋Œ€ํ•œ ๊ถŒํ•œ๊ณผ ํ•จ๊ป˜, ๋ฆด๋ ˆ์ด์…˜์˜ ์ƒ์„ฑ, ์ˆ˜์ •, ์‚ญ์ œ์™€ ๊ฐ™์€ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์Šคํ‚ค๋งˆ ๋ณ€๊ฒฝ ๊ถŒํ•œ๋„ ์‚ฌ์šฉ์ž์—๊ฒŒ ๋ถ€์—ฌํ•  ์ˆ˜ ์žˆ๋‹ค. ์ผ๋ถ€ ํ˜•ํƒœ์˜ ๊ถŒํ•œ์„ ์†Œ์œ ํ•œ ์‚ฌ์šฉ์ž๋Š” ์ž์‹ ์˜ ๊ถŒํ•œ์„ ํƒ€ ์‚ฌ์šฉ์ž์—๊ฒŒ ์ „๋‹ฌํ•˜๊ฑฐ๋‚˜ ์ด์ „์— ๋ถ€์—ฌ๋œ ๊ถŒํ•œ์„ ์ฒ ํšŒํ•  ์ˆ˜ ์žˆ๋‹ค.
โ€ข
Index - ์ธ๋ฑ์Šค์˜ ์ƒ์„ฑ๊ณผ ์‚ญ์ œ
โ€ข
Resources - ์ƒˆ Relation์˜ ์ƒ์„ฑ
โ€ข
Alteration - Relation์˜ ์ƒˆ Attribute์— ๋Œ€ํ•œ ์ถ”๊ฐ€ ํ˜น์€ ์‚ญ์ œ
โ€ข
Drop - Relation์˜ ์‚ญ์ œ

Authorization Specification in SQL

grant๋ฌธ์€ ๊ถŒํ•œ์„ ๋ถ€์—ฌํ•˜๋Š” ์šฉ๋„๋กœ ์‚ฌ์šฉ๋œ๋‹ค.
grant <privilege list> on <relation or view> to <user list>
SQL
๋ณต์‚ฌ
<user list> ์— ๋“ค์–ด์˜ฌ ์ˆ˜ ์žˆ๋Š” ํŒŒ๋ผ๋ฏธํ„ฐ
โ€ข
user-id
โ€ข
public : ๋ชจ๋“  ์œ ์ €์—๊ฒŒ ํŠน๊ถŒ์„ ๋ถ€์—ฌํ•œ๋‹ค.
โ€ข
A role : ์—ญํ• ?

Privileges in SQL

โ€ข
select : Relation์— ์ ‘๊ทผ/์ฝ๊ธฐ ํ˜น์€ view๋ฅผ ์ด์šฉํ•ด ์งˆ์˜ํ•  ์ˆ˜ ์žˆ๋‹ค.
grant select on <relation> to U1, U2, U3...
SQL
๋ณต์‚ฌ
โ€ข
insert : tuple์„ ์ง‘์–ด๋„ฃ๋Š” ๋Šฅ๋ ฅ
โ€ข
Update : SQL update statement๋ฅผ ์ด์šฉํ•ด ์—…๋ฐ์ดํŠธํ•˜๋Š” ๋Šฅ๋ ฅ
โ€ข
delete : ํŠœํ”Œ์„ ์‚ญ์ œํ•˜๋Š” ๋Šฅ๋ ฅ

Revoking Authorization in SQL

revoke๋ฌธ์€ ํŠน๊ถŒ์„ ํ์ง€ํ•˜๋Š” ์ง€์‹œ๋ฌธ์ด๋‹ค.
revoke <privilege-list> on <relation or view> from <user list>
SQL
๋ณต์‚ฌ
โ€ข
<privilege-list>
โ—ฆ
๋ชจ๋“  ๊ถŒํ•œ์„ ๋ฐ•ํƒˆํ•˜๋ ค๋ฉด all ํ‚ค์›Œ๋“œ๋ฅผ ์“ธ ์ˆ˜ ์žˆ๋‹ค.
โ—ฆ
public?
โ€ข
๊ฐ™์€ ํŠน๊ถŒ์ด ๋‹ค๋ฅธ ์œ ์ €์—๊ฒŒ ๋‘๋ฒˆ ํ• ๋‹น๋˜์—ˆ์„ ๊ฒฝ์šฐ, ๋ฐ•ํƒˆ ํ›„์—๋„ ํŠน๊ถŒ์ด ์œ ์ง€๋  ์ˆ˜ ์žˆ๋‹ค.

Roles

์—ญํ•  (Role)์€ ๋‹ค์–‘ํ•œ ์œ ์ €๋กœ๋ถ€ํ„ฐ ๊ฐ ์œ ์ €๊ฐ€ DB์— ์ ‘๊ทผ, ๊ฐฑ์‹ ํ•  ์ˆ˜ ์žˆ๋Š” ๋ฒ”์œ„๋ฅผ ๊ตฌ๋ณ„ํ•˜๊ธฐ ์œ„ํ•œ ๋ฐฉ๋ฒ•์ด๋‹ค.
์—ญํ•  ์ƒ์„ฑ
create role <name>
SQL
๋ณต์‚ฌ
role์ด ์ƒ์„ฑ๋œ ํ›„์— ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์œ ์ €์—๊ฒŒ role์„ ๋ถ€์—ฌํ•  ์ˆ˜ ์žˆ๋‹ค.
grant <role>to <users>
SQL
๋ณต์‚ฌ
A โ†’ B ์ƒํƒœ์˜ ๋กค์—์„œ A๋ฅผ ์‚ญ์ œํ–ˆ์„๋•Œ B๋ผ๋Š” ๋กค์ด ํšจ์šฉ์ด ์—†์„ํ…๋ฐ B๋„ ์ž๋™์ ์œผ๋กœ ์‚ญ์ œ๋˜๋Š”๊ฐ€?
ํ”„๋กœ์„ธ์Šค๋กœ ๋”ฐ์ง€๋ฉด
Next chapter