마

SQL Basics - index(foreign key)

· 2019-06-22 (토) 00:21:13 · 1071

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튜닝

64건
+
제목 글쓴이 날짜 조회
19-06-23 조회 1,179
19-06-23 조회 964
19-06-23 조회 1,049
19-06-23 조회 1,143
19-06-22 조회 1,418
19-06-22 조회 1,018
19-06-22 조회 849
19-06-22 조회 1,072
19-06-22 조회 889
19-06-21 조회 654
19-06-21 조회 798
19-06-21 조회 750
19-06-20 조회 732
19-06-20 조회 689
19-06-20 조회 1,316
19-06-19 조회 1,902
19-06-19 조회 1,619
19-06-18 조회 872
19-06-18 조회 865
19-06-17 조회 1,527
19-05-23 조회 772
18-07-14 조회 944
18-03-28 조회 1,229
15-11-22 조회 3,385
15-11-15 조회 2,622
15-10-29 조회 1,626
15-10-28 조회 1,765
15-10-28 조회 3,640
15-10-27 조회 1,242
15-10-27 조회 1,344