pet store宠物商店数据库设计

宠物商店数据库设计与业务逻辑
本文档描述了petstore数据库的设计,包括Client、account、category、product、orders和lineitem等表的创建,以及相应的业务逻辑。用户注册后可浏览产品,管理员可管理产品分类和产品信息。用户订购宠物时,购物车通过session实现,订单涉及orders、lineitem和product表的交互。
部署运行你感兴趣的模型镜像

数据库具体的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表需要分别填写帐单寄往处、物品寄往处,以及预定日期、总价钱,银行卡号及类型。

您可能感兴趣的与本文相关的镜像

Qwen-Image-Edit-2509

Qwen-Image-Edit-2509

图片编辑
Qwen

Qwen-Image-Edit-2509 是阿里巴巴通义千问团队于2025年9月发布的最新图像编辑AI模型,主要支持多图编辑,包括“人物+人物”、“人物+商品”等组合玩法

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值