Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7632155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:32:55+00:00 2026-05-31T06:32:55+00:00

So I’m trying to create an commerce system for an assignment. I have used

  • 0

So I’m trying to create an commerce system for an assignment. I have used QSEE to create the ERD here is a screen shot of it. I tried to copy and paste each individual statement into the SQL feature but it throws up error messages about fields not existing, importing the entire document doesn’t work:

CREATE TABLE _customer(
CustomerID  INTEGER NOT NULL,
FirstName   VARCHAR(20) NOT NULL,
LastName    VARCHAR(20) NOT NULL,
Building    VARCHAR(20) NOT NULL,
Address1    VARCHAR(30) NOT NULL,
Address2    VARCHAR(30),
City    VARCHAR(20) NOT NULL,
County  VARCHAR(20),
Postcode    VARCHAR(8) NOT NULL,
Phone   INTEGER,
Email   VARCHAR(30) NOT NULL,
Password    VARCHAR(20) NOT NULL,
BillingBuilding VARCHAR(20) NOT NULL,
BillingAddress1 VARCHAR(20) NOT NULL,
BillingAddress2 VARCHAR(20),
BillingCity VARCHAR(20) NOT NULL,
BillingCounty   VARCHAR(20),
BillingPostcode VARCHAR(8) NOT NULL,
ShippingBuilding    VARCHAR(20),
ShippingAddress1    VARCHAR(20),
ShippingAddress2    VARCHAR(20),
ShippingCity    VARCHAR(20),
ShippingCounty  VARCHAR(20),
ShippingPostcode    VARCHAR(8),
-- Specify the PRIMARY KEY constraint for table "_customer".
-- This indicates which attribute(s) uniquely identify each row of data.
CONSTRAINT  pk__customer PRIMARY KEY (CustomerID)
);

CREATE TABLE _product(
    ProductID   INTEGER NOT NULL,
    SKU INTEGER NOT NULL,
    Name    VARCHAR(20),
    Description VARCHAR(100),
    StockQuantity   INTEGER NOT NULL,
    UnitPrice   INTEGER NOT NULL,
    Size    VARCHAR(1) NOT NULL,
    Colour  VARCHAR(8) NOT NULL,
    Picture VARCHAR(15),
    LastUpdate  TIMESTAMP(8),
    fk1_SupplierID  INTEGER NOT NULL,
    -- Specify the PRIMARY KEY constraint for table "_product".
    -- This indicates which attribute(s) uniquely identify each row of data.
    CONSTRAINT  pk__product PRIMARY KEY (ProductID)
);

CREATE TABLE _customerorder(
    OrderID INTEGER NOT NULL,
    OrderDate   TIMESTAMP(8) NOT NULL,
    Amount  DECIMAL(8,2),
    fk1_PaymentID   INTEGER NOT NULL,
    fk2_CustomerID  INTEGER NOT NULL,
    -- Specify the PRIMARY KEY constraint for table "_customerorder".
    -- This indicates which attribute(s) uniquely identify each row of data.
    CONSTRAINT  pk__customerorder PRIMARY KEY (OrderID,fk1_CustomerID)
);

CREATE TABLE _payment(
    PaymentID   INTEGER NOT NULL,
    PaymentType VARCHAR(20) NOT NULL,
    -- Specify the PRIMARY KEY constraint for table "_payment".
    -- This indicates which attribute(s) uniquely identify each row of data.
    CONSTRAINT  pk__payment PRIMARY KEY (PaymentID)
);

CREATE TABLE _orderedproduct(
    OrderDetailID   INTEGER NOT NULL,
    Quantity    INTEGER,
    Total   INTEGER,
    Size    INTEGER,
    Colour  INTEGER,
    fk1_OrderID INTEGER NOT NULL,
    fk1_fk1_CustomerID  INTEGER NOT NULL,
    fk2_ProductID   INTEGER NOT NULL,
    -- Specify the PRIMARY KEY constraint for table "_orderedproduct".
    -- This indicates which attribute(s) uniquely identify each row of data.
    CONSTRAINT  pk__orderedproduct PRIMARY KEY (OrderDetailID)
);

CREATE TABLE _supplier(
    SupplierID  INTEGER NOT NULL,
    CompanyName VARCHAR(20) NOT NULL,
    SalesFirstName  VARCHAR(20) NOT NULL,
    SalesLastName   VARCHAR(20) NOT NULL,
    SalesTitle  VARCHAR(20),
    Address1    VARCHAR(20) NOT NULL,
    Address2    VARCHAR(20),
    City    VARCHAR(20),
    County  VARCHAR(20),
    Phone   INTEGER,
    Email   VARCHAR(30),
    -- Specify the PRIMARY KEY constraint for table "_supplier".
    -- This indicates which attribute(s) uniquely identify each row of data.
    CONSTRAINT  pk__supplier PRIMARY KEY (SupplierID)
);


ALTER TABLE _customerorder ADD CONSTRAINT fk1__customerorder_to__payment FOREIGN KEY(fk1_PaymentID) REFERENCES _payment(PaymentID) ON DELETE RESTRICT ON UPDATE RESTRICT;

ALTER TABLE _orderedproduct ADD CONSTRAINT fk1__orderedproduct_to__customerorder FOREIGN KEY(fk1_OrderID,fk1_fk1_CustomerID) REFERENCES _customerorder(OrderID,fk1_CustomerID) ON DELETE RESTRICT ON UPDATE RESTRICT;

ALTER TABLE _orderedproduct ADD CONSTRAINT fk2__orderedproduct_to__product FOREIGN KEY(fk2_ProductID) REFERENCES _product(ProductID) ON DELETE RESTRICT ON UPDATE RESTRICT;

ALTER TABLE _product ADD CONSTRAINT fk1__product_to__supplier FOREIGN KEY(fk1_SupplierID) REFERENCES _supplier(SupplierID) ON DELETE RESTRICT ON UPDATE RESTRICT;

ALTER TABLE _customerorder ADD CONSTRAINT fk2__customerorder_to__customer FOREIGN KEY(fk2_CustomerID) REFERENCES _customer(CustomerID) ON DELETE RESTRICT ON UPDATE RESTRICT

;

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T06:32:58+00:00Added an answer on May 31, 2026 at 6:32 am

    Change all TIMESTAMP(N) type to TIMESTAMP. The width option (N) was removed long time ago.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to create an if statement in PHP that prevents a single post
I am trying to loop through a bunch of documents I have to put
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.