Oracle M:N 关系表

--M:N 关系表练习

Drop Table PRODUCT
Drop Table SUPPLY
Drop Table PRO_SUP


Create Table PRODUCT  
(
  P_ID Number(10),
  P_NAME Varchar2(20),
  Constraint PK_PR Primary Key (P_ID)
)

Create Table SUPPLY
(
  S_ID Number(10),
  S_NAME Varchar2(20),
  Constraint PK_SU Primary Key (S_ID)
)

Create Table PRO_SUP
(
  S_ID Number(10),
  P_ID Number(10),
  Constraint FK_SU  Foreign Key (S_ID) References SUPPLY(S_ID), --★
  Constraint FK_PR  Foreign Key (P_ID) References PRODUCT(P_ID) --★
)

Select * From SUPPLY
Select * From PRODUCT 
Select * From PRO_SUP

 

你可能感兴趣的:(oracle)