问题描述
我需要帮助,我这次只是学习
我有一张桌子发票
哪个有字段
InvoiceNo
Invoice_amount
Invoice_Date
Exchange_Rate
和秒表是收据
哪个有字段
收据没有
收据安装
Receipt_Date
InvoiceNo
InvoiceDate
Exchange_Rate
现在我需要做什么,这里假设我创建了发票表
Hi,I need help,I am just learning this time
I have a table Invoice
which has fields
InvoiceNo
Invoice_amount
Invoice_Date
Exchange_Rate
and second table is Receipt
which has fields
ReceiptNo
ReceiptAmount
Receipt_Date
InvoiceNo
InvoiceDate
Exchange_Rate
Now What I need to do, here suppose i created a Invoice table
create table Invoice
(
InvoiceNo varchar(15) not null,
InvoiceAmount money not null,
invoiceDate date not null,
ExchangeRate Money not null,
constraint pk_invoice primary key(InvoiceNo),
constraint uk_inv unique (InvoiceNo, InvoiceAmount)
)
我的尝试:
我只是想尝试创建两个表发票和收据
我创建了发票表但是在收据表上我需要参考
InvoiceNo,InvoiceDate所以当我们需要提供参考时如何提供参考在多列上。
请帮助我
i需要帮助我如何在多列上提供外键引用。
What I have tried:
I am just trying to create two tables Invoice and Receipt
I have created Invoice table but On receipt table I need references on
InvoiceNo, InvoiceDate so how I can give references when we need to give references on multiple columns.
please help me
i need help for how I can give foreign key references on multiple column.
CREATE TABLE MyReferencingTable AS (
[COLUMN DEFINITIONS]
refcol1 INT NOT NULL,
rofcol2 INT NOT NULL,
CONSTRAINT fk_mrt_ot FOREIGN KEY (refcol1, refcol2)
REFERENCES OtherTable(col1, col2)
)
这篇关于我如何在多列上提供外键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!