我可以将组合键引用为主键吗

时间:2018-10-13 17:20:39

标签: sqlite syntax foreign-keys

这是团体和比赛的两个表格。我想将COMPOSITE FOREIGN KEY参考写到单个主键

from keras import backend as K
K.__dict__["gradients"] = memory_saving_gradients.gradients_memory

这样写外键可以吗?还是我们必须像

那样单独写
CREATE TABLE IF NOT EXISTS TEAM
(
    team_id integer,
    team_name text,
    PRIMARY KEY (team_id)
)

CREATE TABLE IF NOT EXISTS MATCH
(
    match_id integer,
    season_year integer,
    team1 integer,
    team2 integer,
    batted_first integer,
    batted_second integer,
    venue_name text,
    other entries

    FOREIGN KEY (team1, team2, batted_first, batted_second) 
        REFERENCES TEAM(team_id)
)

0 个答案:

没有答案