Create Table Customer(
CustomerID Int NOT NULL IDENTITY (1,1) ,
LastName Char(25) NOT NULL,
FirstName Char(25) NOT NULL,
EmailAddress VarChar(100) NOT NULL,
EncryptedPassword VarChar(50) NULL,
Phone Char(12) NOT NULL,
StreetAddress Char(35) NULL
City Char(35) NULL DEFAULT 'Dallas',
[State] Char(2) NULL DEFAULT 'TX',
ZIP Char(10) NULL DEFAULT '75201',
CONSTRAINT CUSTOMER_PK PRIMARY KEY(CUSTOMERID),
CONSTRAINT CUSTOMER_EMAIL UNIQUE(EMAILADDRESS)
) ;
CREATE TABLE SEMINAR(
SeminarID INT NOT NULL IDENTITY (1, 1),
SeminarDate Date NOT NULL,
SeminarTime Time NOT NULL,
Location VarChar(100) NOT NULL,
SeminarTitle VarChar(100)
CONSTRAINT SEMINAR_PK PRIMARY KEY(SeminarID)
) ;
Create Table SEMINAR_CUSTOMER(
SeminarID Int NOT NULL,
CustomerID Int NOT NULL,
CONSTRAINT S_C_PK PRIMARY KEY(SeminarID, CustomerID),
CONSTRAINT S_C_SEMINAR_FK FOREIGN KEY(SeminarID)
REFERENCES SEMINAR(SeminarID)
ON UPDATE NO ACTION
ON DELETE NO ACTION
CONSTRAINT S_C_CUSTOMER_FK FOREIGN KEY (CustomerID)
REFERENCES CUSTOMER(CustomerID)
ON UPDATE NO ACTION
ON DELETE NO ACTION
) ;
CREATE TABLE CONTACT(
CustomerID Int NOT NULL,
ContactNumber Int NOT NULL,
ContactDate Date NOT NULL,
ContactType VarChar(30) NOT NULL,
SeminarID Int NULL,
CONSTRAINT CONTACT_PK PRIMARY KEY(CustomerID, ContactNumber),
CONSTRAINT CONTACT_ContactType
CHECK (ContactType IN ('Seminar',
'WebAccountCreation', 'WebPurchase',
'EmailAccountMessage', 'EmailSeminarMessage',
'EmailPurcahseMessage',
'EmailMessageExchange', 'FormLetterSeminar',
'PhoneConversation')),
CONSTRAINT CONTACT_SEMINAR_FK FOREIGN KEY(SeminarID)
REFERENCES SEMINAR(SeminarID)
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT CONTACT_SEMINAR_FK FOREIGN KEY(SeminarID)
REFERENCES SEMINAR(CustomerID)
ON UPDATE NO ACTION
ON DELETE NO ACTION
);
CREATE TABLE PRODUCT(
ProductNumber Char(35) NOT NULL,
ProductType Char(24) NOT NULL,
ProductDescription VarChar(100) NOT NULL,
UnitPrice Numeric(9,2) NOT NULL
QuantityOnHand Int NULL
CONSTRAINT PRODUCT_PK PRIMARY KEY(ProductNumber),
CONSTRAINT PRODUCT_ProductType
CHECK (ProductType) IN ('Video',
'Video Companion', 'Book'))
);
CREATE TABLE INVOICE(
InvoiceNumber Int NOT NULL IDENTITY (35000, 1),
InvoiceDate Date NOT NULL,
CustomerID Int NOT NULL,
PaymentType Char(25) NOT NULL DEFAULT 'Cash',
SubTotal Numeric(9,2) NULL,
Shipping Numeric(9,2) NULL,
Tax Numeric(9,2) NULL,
Total Numeric(9,2) NULL,
CONSTRAINT INVOICE_PK PRIMARY KEY (InvoiceNumber),
CONSTRAINT INVOICE_PaymentType
CHECK (PaymentType IN ('VISA',
'MasterCard', 'American Express',
'PayPal', 'Check', 'Cash')),
CONSTRAINT INVOICE_CUSTOMER_FK FOREIGN KEY(CustomerID)
REFERENCES CUSTOMER(CustomerID)
ON UPDATE NO ACTION
ON DELETE NO ACTION
);
CREATE TABLE LINE_ITEM(
InvoiceNumber Int NOT NULL,
LineNumber Int NOT NULL,
ProductNumber Char(35) NOT NULL,
Quantity Int NOT NULL
UnitPrice Numeric(9,2) NULL
Total Numeric(9,2) NULL
CONSTRAINT LINE_ITEM_PK PRIMARY KEY (InvoiceNumber, LineNumber),
CONSTRAINT L_I_INVOICE_FK FOREIGN KEY (InvoiceNumber)
REFERENCES INVOICE(InvoiceNumber)
ON UPDATE NO ACTION
ON DELETE NO ACTION
CONSTRAINT L_I_PRODUCT_FK FOREIGN KEY (ProductNumber)
REFERENCES Product (ProductNumber)
ON UPDATE NO ACTION
ON DELETE NO ACTION
);
这是我的全部密码。直接从书上抄下来上课。我的教授不会帮我的,所以我希望这里能帮上忙。在过去的三天里,我只做了这方面的工作。这是我一直收到的关于“身份”的错误信息:
标识在此位置不是有效输入,应为:')'
请帮帮我,我今天需要这个。
暂无答案!
目前还没有任何答案,快来回答吧!