国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費(fèi)電子書(shū)等14項(xiàng)超值服

開(kāi)通VIP
one-to-many,one-to-one and many-to-many associations
create table USERS (
    USER_ID bigint not null primary key,
    USERNAME varchar(15) not null unique,
    NAME varchar(50) not null,
...
)

create table BILLING_DETAILS (
    BILLING_DETAILS_ID bigint not null primary key,
    ACCOUNT_NUMBER VARCHAR(10) not null unique,
    ACCOUNT_NAME VARCHAR(50) not null,
    ACCOUNT_TYPE VARCHAR(2) not null,
    USER_ID bigint foreign key references USERS
)
 
This is one-to-many associations:
Table associations, on the other hand, are always one-to-many or one-to-one. You can
see the multiplicity immediately by looking at the foreign key definition. The following
is a foreign key declaration on the BILLING_DETAILS table for a one-tomany
association (or, if read in the other direction, a many-to-one association):

USER_ID bigint foreign key references USERS
 

These are one-to-one associations:
 

USER_ID bigint unique foreign key references USERS

BILLING_DETAILS_ID bigint primary key foreign key references USERS
 
the two are equals.
 
many-to-many associations:
If you wish to represent a many-to-many association in a relational database, you
must introduce a new table, called a link table. This table doesn’t appear anywhere
in the domain model. For our example, if we consider the relationship between
the user and the billing information to be many-to-many, the link table is defined
as follows:

create table USER_BILLING_DETAILS (
    USER_ID bigint foreign key references USERS,
    BILLING_DETAILS_ID bigint foreign key references BILLING_DETAILS,
    PRIMARY KEY (USER_ID, BILLING_DETAILS_ID)
)
 
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開(kāi)APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
oracle pl/sql 中表的創(chuàng)建
MySQL的分區(qū)表(Partitioned Table)功能詳解
Otter雙A同步搭建入門(mén)教程
Mysql分表的詳細(xì)設(shè)計(jì)與應(yīng)用
SQL經(jīng)典面試題集錦
SpringBoot2.1-quartz集成yml方式
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服