综合案例
ddl&dml
有一个商品数据库
1.数据表的创建    ddl

先编写数据库脚本
--删除数据表
drop table purcase purge;
drop table product purge;
drop table customer purge;
--创建数据表
create table product(
    product_id varchar2(5),
    product_name varchar2(30) not null,
    unit_price number,
    category varchar2(50),
    provider varchar2(50),
    constraint pk_product_id primary key(product_id),
    constraint ck_unit_price check(unit_price>0)
);
create table customer(
    customer_id varchar2(5),
    customer_name varchar2(30) not null,
    location varchar2(50),
    constraint pk_customer_id primary key(customer_id)
);
create table purcase(
    customer_id varchar2(5),
    product_id varchar2(5),
    quantity number,
    constraint fk_customer_id foreign key(customer_id) references customer(customer_id) on delete cascade,
    constraint fk_product_id foreign key(product_id) references product(product_id) on delete cascade,
    constraint ck_quantity check(quantity)
);

--增加测试数据
--增加产品信息
insert into product(product_id,product_name,unit_price,category,provider)
values('M01','jjs',8.00,'yg','bj');
insert into product(product_id,product_name,unit_price,category,provider)
values('M02','glj',6.50,'yg','glj');
insert into product(product_id,product_name,unit_price,category,provider)
values('M03','jl',5.00,'yg','lhlh');
insert into product(product_id,product_name,unit_price,category,provider)
values('M04','sfj',3.00,'xz','bj');
insert into product(product_id,product_name,unit_price,category,provider)
values('M05','xsl',5.00,'xz','lhlh');
insert into product(product_id,product_name,unit_price,category,provider)
values('M06','dp',2.50,'xyf','nas');
insert into product(product_id,product_name,unit_price,category,provider)
values('M07','zh',3.50,'yg','lhlh');
insert into product(product_id,product_name,unit_price,category,provider)
values('M08','tz',3.00,'xyf','bj');
insert into product(product_id,product_name,unit_price,category,provider)
values('M09','bl',4.00,'xyf','bj');
--增加客户信息
insert into customer(customer_id,customer_name,location)
values('C01','Dennis','hd');
insert into customer(customer_id,customer_name,location)
values('C02','John','cy');
insert into customer(customer_id,customer_name,location)
values('C03','Tom','dc');
insert into customer(customer_id,customer_name,location)
values('C04','Jenny','dc');
insert into customer(customer_id,customer_name,location)
values('C05','Rick','xc');
--增加购买记录
insert into purcase(customer_id,product_id,quantity)
values('C01','M01',3);
insert into purcase(customer_id,product_id,quantity)
values('C01','M05',2);
insert into purcase(customer_id,product_id,quantity)
values('C01','M08',2);
insert into purcase(customer_id,product_id,quantity)
values('C02','M02',5);
insert into purcase(customer_id,product_id,quantity)
values('C02','M06',4);
insert into purcase(customer_id,product_id,quantity)
values('C03','M01',1);
insert into purcase(customer_id,product_id,quantity)
values('C03','M05',1);
insert into purcase(customer_id,product_id,quantity)
values('C03','M06',3);
insert into purcase(customer_id,product_id,quantity)
values('C03','M08',1);
insert into purcase(customer_id,product_id,quantity)
values('C04','M03',7);
insert into purcase(customer_id,product_id,quantity)
values('C04','M04',3);
insert into purcase(customer_id,product_id,quantity)
values('C05','M06',2);
insert into purcase(customer_id,product_id,quantity)
values('C05','M07',8);
commit;

oracle数据库从入门到精通之三的更多相关文章

  1. Oracle数据库从入门到精通 单行函数问题

    视频课程:李兴华 Oracle从入门到精通视频课程 学习者:阳光罗诺 视频来源:51CTO学院 Oracle数据库从入门到精通-单行函数 在数据库中,为了方便用户的数据开发,往往会提供一系列的支持函数 ...

  2. Oracle数据库从入门到精通 多表查询知识以及范例

    视频课程:李兴华 Oracle从入门到精通视频课程 学习者:阳光罗诺 视频来源:51CTO学院 总体内容: 多表查询的意义以及基本问题. 表的连接查询 SQL:1999语法标准对多表查询的支持. 数据 ...

  3. Oracle数据库从入门到精通-分组统计查询

    视频课程:李兴华 Oracle从入门到精通 视频课程学习者:阳光罗诺 视频来源:51CTO学院 整体内容: 统计函数的使用 分组统计查询的实现 对分组的数据过滤 统计函数 在之前我们就学习过一个COU ...

  4. oracle数据库从入门到精通

    oracle产品线围绕企业开发平台的企业开发平台四大组件:unix,weblogic中间件,java编程语言,oracle数据库oracle 开发主要分两类数据库管理:dba数据库编程:分两部分   ...

  5. oracle数据库从入门到精通之四

    序列是oracle中较为重要的概念事务对于ddl是不起作用的查询,更新,数据表,约束这些个概念要掌握.在许多数据库之中都会存在一种数据类型--自动增长列,它能够创建流水号12c之前并没有提供这样一个自 ...

  6. Oracle数据库基础入门《二》Oracle内存结构

    Oracle数据库基础入门<二>Oracle内存结构 Oracle 的内存由系统全局区(System Global Area,简称 SGA)和程序全局区(Program Global Ar ...

  7. Oracle数据库基础入门《一》Oracle服务器的构成

    Oracle数据库基础入门<一>Oracle服务器的构成 Oracle 服务器是一个具有高性能和高可靠性面向对象关系型数据库管理系统,也是一 个高效的 SQL 语句执行环境. Oracle ...

  8. 《MySQL数据库从入门到精通》 高级运维人才的必备书籍

    众所周知,每年就业市场都会迎来千万量级的高校毕业生,然而企业招工难和毕业生就业难的矛盾却一直没有得到很好地解决.究其原因,主要矛盾还是在于传统的学历教育与企业实际需求相脱节.为了杜绝高校毕业生求职时常 ...

  9. 《Oracle PLSQL从入门到精通》pdf电子版

    链接:https://pan.baidu.com/s/1fhfMtmwM_hOAGgYOfNYlkw提取码:r53a 学习pl/sql的同学,可以看看这本书,讲解的很详细,从入门到精通,大家有什么不懂 ...

随机推荐

  1. webdynpro

    -------------------------------------------------------------------------------------WebDynpro For A ...

  2. 手机支持USB功能、驱动文件对应关系

    手机支持USB功能: 1.UMS(USB MASS Stronge) : 连接PC作为存储盘使用 2.ADB : 用于调试 3.MTP :连接PC作为存储盘使用(win XP需要安装WMP10 以上 ...

  3. WebStrom 10 注册码(转)

    webStorm : UserName:William ===== LICENSE BEGIN ===== 45550-12042010 00001SzFN0n1bPII7FnAxnt0DDOPJA ...

  4. BZOJ 1597 土地购买

    斜率优化... #include<iostream> #include<cstdio> #include<cstring> #include<algorith ...

  5. Object.prototype 与 Function.prototype 与 instanceof 运算符

    方法: hasOwnProperty isPrototypeOf propertyIsEnumerable hasOwnProperty 该方法用来判断一个对象中的某一个属性是否是自己提供的( 住要用 ...

  6. 总结之H3C汇聚层交换机认证在线人数展示系统

    前情提要:意外接了老师说的一个小程序,然后计划7天(实际10天)的小项目就冒出来了. (1)时间与工程量.在和老师开始谈具体需求前,我凭感觉猜了猜完成这个小项目的时间.然后,再和老师确定需求后,再回头 ...

  7. Exchange 基本命令累计

    Get-ExchangeServer | fl name,edition,admindisplayversion  //查看exchange服务器版本

  8. 回文数组(Rotate Array (JS))

    旋转一个数组. function rotate(array,n){ var l =array.length,a=array.map(function(x){return x}),arr=[]; n=n ...

  9. tornado中self.write() 写list

    tornado源码中不支持在self.write()中直接传入list对象,源代码如下 def write(self, chunk): if self._finished: raise Runtime ...

  10. ViewStub的简单用法和说明

    最近无意间知道了ViewStub,所以特地的去了解了一下 都知道ViewStub是一个不可见的,大小为0的View,实际上跟include差不多,但是ViewStub要更加节约资源.被称为是" ...