SQL Basics - index(foreign key)

· 6년 전 · 913

Foreign Key를 세팅하기 전에는 아래 데이타가 들어감

insert into customer.Orders (OrderDate, CustomerID, ProductID) values (now(), 4, 2);

 

alter table cusomer.orders
add foreign key (CustomerID) references Customer(ID);

 

alter table customer.orders
add foreign key (ProductID) references Products(ID);

 

위와 같이 Foreign Key를 세팅해 두면 같은 insert문장이라도  에러가 남.

 

insert into customer.Orders (OrderDate, CustomerID, ProductID) values (now(), 4, 2);

 

800594872_1560973502.9564.png

 

https://youtu.be/9Pzj7Aj25lw?list=PLD20298E653A970F8&t=2693

|
댓글을 작성하시려면 로그인이 필요합니다. 로그인

그누5튜닝

+
제목 글쓴이 날짜 조회
6년 전 조회 1,167
6년 전 조회 1,299
6년 전 조회 1,256
6년 전 조회 3,190
6년 전 조회 1,378
6년 전 조회 1,383
6년 전 조회 1,402
6년 전 조회 997
6년 전 조회 788
6년 전 조회 901
6년 전 조회 1,002
6년 전 조회 1,266
6년 전 조회 805
6년 전 조회 682
6년 전 조회 914
6년 전 조회 740
6년 전 조회 515
6년 전 조회 657
6년 전 조회 606
6년 전 조회 598
6년 전 조회 549
6년 전 조회 1,173
6년 전 조회 1,726
6년 전 조회 1,438
6년 전 조회 730
6년 전 조회 730
6년 전 조회 1,405
6년 전 조회 644
7년 전 조회 826
7년 전 조회 1,109
🐛 버그신고