Can a table have two foreign keys?

前端 未结 4 1812
一整个雨季
一整个雨季 2021-02-02 10:02

I have the following tables (Primary key in bold. Foreign key in Italic)

Customer table

  • ID---Name---Balance---
4条回答
  •  深忆病人
    2021-02-02 11:06

    create table Table1
    (
      id varchar(2),
      name varchar(2),
      PRIMARY KEY (id)
    )
    
    
    Create table Table1_Addr
    (
      addid varchar(2),
      Address varchar(2),
      PRIMARY KEY (addid)
    )
    
    Create table Table1_sal
    (
      salid varchar(2),`enter code here`
      addid varchar(2),
      id varchar(2),
      PRIMARY KEY (salid),
      index(addid),
      index(id),
      FOREIGN KEY (addid) REFERENCES Table1_Addr(addid),
      FOREIGN KEY (id) REFERENCES Table1(id)
    )
    

提交回复
热议问题