`
chaoyi
  • 浏览: 309719 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

gome.sql

 
阅读更多
--数据库名:gome 账号:gome 密码:gome
create user gome identified by gome;
grant dba to gome;

--drop user gome cascade

--用户表(gome_user)
create table gome_user(
gu_user_id varchar2(20) not null primary key, --用户名 主键
gu_user_name varchar(20), --用户真实姓名
gu_password varchar(20) not null, --密码
gu_identity_code varchar2(60), --身份证号
gu_email varchar2(80) not null, --email
gu_mobile varchar2(11), --手机号码
gu_tel varchar2(8), --固定电话
gu_address varchar2(400), --收货地址
gu_style_id number(6,0) not null, --用户类型表编号
gu_cancel char(1) not null,--0在用,1注销
foreign key(gu_style_id) references user_style(gu_style_id)--用户类型表主外键
)

--评论表(gome_comment)
create table gome_comment(
gc_comment_id number(10,0) not null primary key,--评论编号
gp_goods_id number(10,0) not null,--商品编号
gc_content varchar2(200) not null,--发表的留言内容
gc_create_time date not null,--创建时间
gc_approval number(10,0) not null,--赞同的人数
gu_user_id varchar2(20) not null,--用户名
gc_cancel char(1) not null,--审核(0通过,1不通过)
foreign key(gp_goods_id) references gome_product(gp_goods_id),--商品表主外键
foreign key(gu_user_id) references gome_user(gu_user_id)--用户表主外键
)

--回复表(gome_reply)
create table gome_reply(
gr_reply_id number(10,0) not null primary key,--回复编号
gc_comment_id number(10,0) not null,--评论编号
gr_reply varchar2(200) not null,--针对留言的回复
gr_reply_time date not null,--回复时间
gr_approval number(10,0) not null,--赞同的人数
gu_user_id varchar2(20) not null,--用户名
foreign key(gc_comment_id) references gome_comment(gc_comment_id),--评论表主外键
foreign key(gu_user_id) references gome_user(gu_user_id)--用户表主外键
)

--商品表(gome_product)
create table gome_product(
gp_goods_id number(10,0) not null primary key,--商品编号
gp_name varchar2(30) not null,--商品名称
gp_description varchar2(300) not null,--商品描述
gp_present varchar2(300) not null,--商品介绍
gp_stock number(10,0) not null,--商品库存 
gp_price number(10,2) not null,--商品价钱
gcr_class_id number(10,0) not null,--分类的编号
gcc_child_id number(10,0) not null,--类别的二级的编号
gp_file_name130w varchar2(100) not null,--上传文件名130w
gp_file_name160w varchar2(100) not null,--上传文件名160w
gp_upload_time date not null,--上传时间
gp_judge char(1) not null,--原价/降价(0/1)
gp_cancel char(1) not null,--0在线商品,1下架商品
foreign key(gcr_class_id) references gome_class_relation(gcr_class_id),--商品分类关系表主外键
foreign key(gcc_child_id) references gome_child_category(gcc_child_id)--商品部类关系表主外键
)

--商品搜索页面分类关系表(gome_class_relation)
create table gome_class_relation(
gcr_class_id number(10,0) not null primary key,--分类的编号
gbc_brand_id number(10,0) not null,--品牌的编号
gcc_category_id number(10,0) not null,--产品类别的编号
goc_other_id number(10,0) not null,--其他的编号
foreign key(gbc_brand_id) references gome_brand_class(gbc_brand_id),--商品品牌分类表主外键
foreign key(gcc_category_id) references gome_category_class(gcc_category_id),--商品产品类别表主外键
foreign key(goc_other_id) references gome_other_class(goc_other_id)--商品其他分类表主外键
)

--商品搜索页面父分类(gome_parent_class)
create table gome_parent_class(
gpc_parent_id number(10,0) not null primary key,--父分类id
gpc_parent_name varchar2(50) not null--父分类内容
)

--商品搜索页面品牌分类(gome_brand_class)
create table gome_brand_class(
gbc_brand_id number(10,0) not null primary key,--品牌的编号
gbc_brand_name varchar2(50) not null,--品牌分类内容
gpc_parent_id number(10,0) not null,--所属父分类id
foreign key(gpc_parent_id) references gome_parent_class(gpc_parent_id)--商品父分类表主外键
)

--商品搜索页面产品类别(gome_category_class)
create table gome_category_class(
gcc_category_id number(10,0) not null primary key,--产品类别的编号
gcc_category_name varchar2(50) not null,--产品类别的内容
gpc_parent_id number(10,0) not null,--所属父分类id
foreign key(gpc_parent_id) references gome_parent_class(gpc_parent_id)--商品父分类表主外键
)

--商品搜索页面其他分类(gome_other_class)
create table gome_other_class(
goc_other_id number(10,0) not null primary key,--其他分类的编号
goc_other_name varchar2(50) not null,--其他分类的内容
gpc_parent_id number(10,0) not null,--所属父分类id
foreign key(gpc_parent_id) references gome_parent_class(gpc_parent_id)--商品父分类表主外键
)

--商品一级分类表(gome_parent_category)
create table gome_parent_category(
gpc_parent_id number(10,0) not null primary key,--所属一级分类id
gpc_parent_name varchar2(20) not null--所属一级分类名称
)

--商品二级分类表(gome_child_category)
create table gome_child_category(
gcc_child_id number(10,0) not null primary key,--所属二级分类id
gcc_child_name varchar2(50) not null,--所属二级分类名称
gpc_parent_id number(10,0) not null,--所属一级分类id
foreign key(gpc_parent_id) references gome_parent_category(gpc_parent_id)--商品一级分类表主外键
)

--商品内容表(gome_product_detail)
create table gome_product_detail(
gpd_id number(10,0) not null primary key,--编号
gp_goods_id number(10,0) not null,--商品编号
gpd_file_name750w varchar2(100) not null,--上传文件名750w
foreign key(gp_goods_id) references gome_product(gp_goods_id)--商品表主外键
)

--订单主表(gome_order_h)
create table gome_order_h(
goh_id number(10,0) not null primary key,--订单号
gu_user_id varchar2(20) not null,--用户名
goh_create_time date not null,--创建时间
goh_totalprice number(10,2) not null,--总金额
goh_status_id number(6,0) not null,--状态编号
goh_payment_style_id number(6,0) not null,--付款方式编号
goh_cancel char(1) not null,--0为有用订单,1为撤消订单
foreign key(gu_user_id) references gome_user(gu_user_id)--用户表主外键
)

--订单子表(gome_order_b)
create table gome_order_b(
gob_id number(10,0) not null primary key,--编号
goh_id number(10,0) not null,--订单号
gp_goods_id number(10,0) not null,--商品编号
gob_count number(10,0) not null,--数量
gob_price number(10,2) not null,--单价
foreign key(gp_goods_id) references gome_product(gp_goods_id),--商品表主外键
foreign key(goh_id) references gome_order_h(goh_id)--订单主表主外键
)

--大图与小图表(gome_images)
create table gome_images(
gi_id number(10,0) not null primary key,--编号
gp_goods_id number(10,0) not null,--商品编号
gi_file_smallimg varchar2(100) not null,--上传小图50w
gi_file_bigimg varchar2(100) not null,--上传大图800w
foreign key(gp_goods_id) references gome_product(gp_goods_id)--商品表主外键
)

--用户类型表(user_style)
create table user_style(
gu_style_id number(6,0) not null primary key,--用户类型编号
gu_style_name varchar2(50) not null--用户类型名称
)

--订单状态表(order_status)
create table order_status(
go_status_id number(6,0) not null primary key,--订单状态编号
go_status__name varchar2(20) not null --订单状态名称
)

--付款方式表(order_payment_style)
create table order_payment_style(
go_payment_style_id number(6,0) not null primary key,--付款方式编号
go_payment_style_name varchar2(10) not null --付款方式名称
)

/*create sequence name_seq -- 尽量使用统一前缀命名,方便管理  建议使用table名+_seq 例如:gome_user_seq
     increment by 1   -- 自增步长 这里设置为1  
     start with 1     -- 计数起点 这里设置为1  
     nomaxvalue       -- 不设置最大值 可选项 maxvalue|minvalue  
     nocycle          -- 一直累加,不循环    
     cache 10;   */
     
/*如果追求效率 可设置缓存 如果在Oracle宕机或者断电等非正常中断服务的
情况 可能会造成序列不连继续的情况出现,如果不使用缓存,则这里写NOCHACHE */

/*序列号命名模式*/
--评论表(gome_comment)
create sequence gome_comment_seq 
     
--回复表(gome_reply)
create sequence gome_reply_seq 

--商品表(gome_product)     
create sequence gome_product_seq

--商品内容表(gome_product_detail)     
create sequence gome_product_detail_seq

--订单主表(gome_order_h)    
create sequence gome_order_h_seq

--订单子表(gome_order_b)     
create sequence gome_order_b_seq

--大图与小图表(gome_images)     
create sequence gome_images_seq 
     
--用户类型表(user_style)     
create sequence user_style_seq
     
--订单状态表(order_status)     
create sequence order_status_seq 
     
--付款方式表(order_payment_style)     
create sequence order_payment_style_seq


/*查询表*/
--用户表(gome_user)
select * from gome_user

--评论表(gome_comment)
select * from gome_comment
insert into gome_comment
  (gc_comment_id, gp_goods_id, gc_content, gc_create_time, gc_approval, gu_user_id, gc_cancel)
values
  (222, 9, '我给妈妈订的 机器拿到手 盒子就比较旧 拆开后 发现机器上全是指纹,', sysdate, 19,'abigail', '0');


--回复表(gome_reply)
select * from gome_reply

--商品表(gome_product)
select * from gome_product g ,gome_images gi where g.gp_goods_id=gi.gp_goods_id

--商品搜索页面分类关系表(gome_class_relation)
select * from gome_class_relation for update

--商品搜索页面父分类(gome_parent_class)
select * from gome_parent_class

--商品搜索页面品牌分类(gome_brand_class)
select * from gome_brand_class

--商品搜索页面产品类别(gome_category_class)
select * from gome_category_class

--商品搜索页面其他分类(gome_other_class)
select * from gome_other_class

--商品一级分类表(gome_parent_category)
select * from gome_parent_category

--商品二级分类表(gome_child_category)
select * from gome_child_category

--商品内容表(gome_product_detail)
select * from gome_product_detail


--订单主表(gome_order_h)
select * from gome_order_h

--订单子表(gome_order_b)
select * from gome_order_b

--大图与小图表(gome_images)
select count(*) from gome_images where gp_goods_id=320 for update

--用户类型表(user_style)
select * from user_style

--订单状态表(order_status)
select * from order_status


--付款方式表(order_payment_style)
select * from order_payment_style

--导出
exp gome/gome@localhost/oracle10  file=D:\mydate\gome.dmp tables=(gome_user,gome_comment,gome_reply,gome_product,gome_class_relation,gome_parent_class,gome_brand_class,gome_category_class,gome_other_class,gome_parent_category,gome_child_category,gome_product_detail,gome_order_h,gome_order_b,gome_images,user_style,order_status,order_payment_style)

--导入
imp gome/gome@localhost/oracle10 file=D:\mydate\gome.dmp full=y

 

分享到:
评论

相关推荐

    win11安装SQL Server 2005时提示“服务无法启动”;sqlservr64.rar 下载

    2、下载本文的附件,sqlservr64.rar 解压密码gome5 3、将下载的文件解压出sqlservr.exe和sqlos.dll两个文件,复制到Binn文件夹里面覆盖原文件(即点击替换)。 例如“C:\Program Files\MicrosoftSQLServer\MSSQL.2\...

    基于ssm模仿国美商城.rar

    3. **MyBatis**:是一个持久层框架,它提供了一种灵活的SQL映射机制,将SQL语句与Java代码分离,使数据库操作变得更加简单。 4. **DAO(数据访问对象)层**:通过MyBatis与数据库交互,执行CRUD(创建、读取、更新...

    整站源码_2013国美ECSHOP模板.zip

    4. **数据库文件**:SQL文件,用于创建和初始化ECSHOP的数据库结构,包含商品分类、用户信息、订单数据等表。 5. **配置文件**:如config.php,用于设置网站的基本信息和连接数据库。 6. **图片资源**:产品图片、...

    国美电器网上采购系统VB源码

    《国美电器网上采购系统VB源码》是一个基于Visual Basic(VB)开发的软件项目,主要功能是实现电器产品的在线采购流程。这个系统对于学习和理解电子商务应用开发,特别是采购管理模块具有很好的参考价值,同时也适合...

    2013国美商城ECSHOP模板

    2013年的ECSHOP模板可能已经考虑了数据加密、防止SQL注入、XSS攻击等安全措施,保障用户信息和交易的安全。 5. **SEO优化**: 模板可能针对搜索引擎优化,包括关键词设置、元标签优化、URL结构优化等,提高网站在...

    数据挖掘项目总报告PPT学习教案.pptx

    - 数据资源选择:选取国美电器某门店的进销存系统数据,SQL Server作为数据库平台。 - 数据分析:重点关注彩电销售数据,包括品牌、规格、价格、数量和毛利等。 - 工具与方法:使用Microsoft SQL Server 2000的...

    明略大数据产品演进介绍.pdf

    6. **案例分享**:虽然文档未具体提及,但明略数据在实践中积累了包括国美、苏宁、北京电视台、银联、地税和邮储银行等在内的客户案例,这些案例可能展示了如何成功应对大数据落地中的各种挑战并实现价值。...

    基于SSM+mysql的电器网上订购系统源码数据库.doc

    在当前电商环境下,许多大型电器零售商如国美电器等,其线下门店规模不断扩张,但同时也面临着消费者无法便捷获取产品信息、耗费大量时间等问题。为了解决这些问题,开发一个高效的电器网上订购系统变得非常必要。...

    数据挖掘计划书PPT学习教案.pptx

    在项目研究内容上,选择了国美电器的进销存系统数据,利用SQL Server数据库,包含财务、商品信息和销售记录等多个方面,为数据挖掘提供了丰富的素材。项目的目标是找出隐藏在销售记录中的潜在关联,以辅助管理层决策...

    深度讲解:WAS应用故障诊断PPT

    WAS应用故障诊断PPT...主要支持或参与项目有:大连烟草,广西烟草,上海烟草,广西玉柴,东风汽车,南京雨润,北京燃气,北京国美,北京人寿,中华保险,长江电力,金六福酒业,河北金能,武汉商业,恒安纸业等等。

    Apache Kylin大数据驱动商务革新.pptx

    同时,这些系统的实施周期长,例如国美的运营参谋系统计划开发一年,导致商业决策的响应速度减慢。 大数据处理效率低下是另一个关键问题。例如,eBay的搜索引擎流量分析存在两天的数据滞后,易观的用户画像分析需要...

    java爬取各大平台价格

    该项目涵盖了京东、苏宁、亚马逊、唯品会、淘宝、天猫和国美的价格爬取,这要求爬虫程序具有良好的可扩展性和通用性。针对每个平台,可能需要分析其特定的URL结构和数据格式,以正确地构造请求和解析响应。例如,...

    面试题截图1

    以下是一些可能出现在【去哪儿面试题】、【国美面试题】、【宝利软件面试题】、【凡普金科】以及【boss直聘面试题】中的常见知识点,以及对这些知识点的详细解释: 1. 数据结构与算法: - **链表**:面试中常问到...

Global site tag (gtag.js) - Google Analytics