pet store寵物商店資料庫設計__資料庫

來源:互聯網
上載者:User

資料庫具體的sql查詢檔案內容如下:

create database petstore;

use petstore

create table Client (

username varchar(25) not null,

passwd varchar(25) not null,

constraint pk_Client primary key (username)

);

 

create table account (

userid varchar(25) not null,

email varchar(80) not null,

fullname varchar(80) not null,

country varchar(20) not null,

city varchar(80) not null,

address varchar(80) not null,

zip varchar(20) not null,

phone varchar(80) not null,

constraint pk_account primary key (userid),

constraint fk_account foreign key (userid)

references Client (username)

)

 

create table category (

catid char(10) not null,

catname varchar(80) null,

descn varchar(255) null,

constraint pk_category primary key (catid)

)

 

create table product (

productid char(10) not null,

catid char(10) not null,

name varchar(80) null,

descn varchar(255) null,

pic varchar(255) null,

listprice decimal(10,2) null,

unitcost decimal(10,2) null,

qty int not null,

constraint pk_product primary key (productid),

constraint fk_product_1 foreign key (catid)

references category (catid)

)

 

create table orders (

orderid int not null AUTO_INCREMENT,

userid varchar(25) not null,

orderdate date not null,

ordertime time not null,

shiptoname varchar(80) not null,

shipcountry varchar(20) not null,

shipcity varchar(80) not null,

shipaddress varchar(80) not null,

shipzip varchar(20) not null,

shipphone varchar(80) not null,

billtoname varchar(80) not null,

billcountry varchar(20) not null,

billcity varchar(80) not null,

billaddress varchar(80) not null,

billzip varchar(20) not null,

billphone varchar(80) not null,

totalprice numeric(10,2) not null,

creditcard varchar(80) not null,

cardtype varchar(80) not null,

constraint pk_orders primary key (orderid),

constraint fk_orders_1 foreign key (userid)

references account (userid)

)

 

create table lineitem (

orderid int not null,

itemid char(10) not null,

quantity int not null,

unitprice numeric(10,2) not null,

constraint pk_lineitem primary key (orderid,itemid),

constraint fk_lineitem_1 foreign key (orderid)

references orders (orderid),

constraint fk_lineitem_2 foreign key (itemid)

references product (productid)

)

商務邏輯:

1、   使用者註冊:輸入使用者名稱、密碼、郵箱、全名、國家、城市、住址、郵編、電話                   註冊成功後就可以進行按產品的分類瀏覽網站

2、   產品管理:為管理員所用,管理員可以增加產品分類,以及為每個分類增加產品,其中產品包括產品名,產品介紹,市場價格,當前價格,數量

3、   使用者訂購寵物:當使用者看重某個寵物時,可以加入使用者的購物車(用session實現)當使用者購物車寵物選擇完畢時,就可以進行預定,預定涉及到的表為orders,lineitem,product。其中orders表需要分別填寫帳單寄往處、物品寄往處,以及預定日期、總價錢,銀行卡號及類型。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.