-- 商品表 --

CREATE TABLE "SCOTT"."GOODS"
(
"id" NUMBER NOT NULL,
"name" VARCHAR2(255) NULL,
"price" NUMBER NULL,
"unit" VARCHAR2(255) NULL,
"address" VARCHAR2(255) NULL,
"pack" VARCHAR2(255) NULL,
"property" VARCHAR2(255) NULL,
PRIMARY KEY ("id")
)
NOCOMPRESS
; COMMENT ON COLUMN "SCOTT"."GOODS"."id" IS '商品编号'; COMMENT ON COLUMN "SCOTT"."GOODS"."name" IS '商品名称'; COMMENT ON COLUMN "SCOTT"."GOODS"."price" IS '价格'; COMMENT ON COLUMN "SCOTT"."GOODS"."unit" IS '单位'; COMMENT ON COLUMN "SCOTT"."GOODS"."address" IS '产地'; COMMENT ON COLUMN "SCOTT"."GOODS"."pack" IS '包装'; COMMENT ON COLUMN "SCOTT"."GOODS"."property" IS '特征'; -- 查询所有根据id排序 --
SELECT * FROM GOODS ORDER BY "id"; -- 单条添加 --
INSERT INTO GOODS ("id","name","price","unit","address","pack","property")
VALUES (1,'三只松鼠',39.9,'120.0g','国产','袋装','带皮'); -- 批量添加 --
INSERT ALL
INTO GOODS ("id","name","price","unit","address","pack","property") VALUES(2,'百草味熟板栗仁',13.0,'90.0g','国产','袋装','果仁')
INTO GOODS ("id","name","price","unit","address","pack","property") VALUES(3,'三只松鼠开口松子',35.9,'245.0g','国产','袋装','带皮')
INTO GOODS ("id","name","price","unit","address","pack","property") VALUES(4,'碧东碧东6味全坚果',110.0,'5.8kg','国产','礼盒装','带皮')
INTO GOODS ("id","name","price","unit","address","pack","property") VALUES(5,'鲁花花生油',165.90,'120.0g','国产','独立包装','压榨')
INTO GOODS ("id","name","price","unit","address","pack","property") VALUES(6,'太粮籼米',99.0,'10.06kg','国产','袋装','无')
SELECT 1 FROM dual; -- 更新操作 --
UPDATE GOODS SET "name"='三只松鼠开心果' WHERE "id"=1; -- 删除操作 --
DELETE FROM GOODS WHERE "id"=7; -- 分页查询 --
-- 1*3 (page*size) 第一页,每页4个
-- (1-1)*4 (page-1)*size
SELECT * FROM(SELECT ROWNUM AS rowno,g.* FROM GOODS g
WHERE ROWNUM <= 1 * 4
)TABLE_ALIAS WHERE TABLE_ALIAS.ROWNO > (1-1)*4; -- 有order by 情况
SELECT * FROM(
SELECT ROWNUM AS rowno,G.* FROM(
SELECT * FROM GOODS G WHERE G."property"='带皮' ORDER BY G."id" DESC
) G
WHERE ROWNUM <= 1 * 4
) TABLE_ALIAS WHERE TABLE_ALIAS.ROWNO > (1 - 1) * 4; --- sql server 分页
--- 根据fssj 排序分页,一页10个 ,2 - 1 表示第2 页
SELECT * FROM( SELECT (row_number() over(order by fssj DESC) - 1) / 10 as pagenum,fssj,name,message FROM sjdxfk sf WHERE fssj LIKE '2019-03-08%' AND mbbh LIKE 'scly')t where pagenum = 2 - 1;

oracle 简单crud的更多相关文章

  1. Oracle简单常用的数据泵导出导入(expdp/impdp)命令举例(上)

    <Oracle简单常用的数据泵导出导入(expdp/impdp)命令举例(上)> <Oracle简单常用的数据泵导出导入(expdp/impdp)命令举例(下)> 目的:指导项 ...

  2. Oracle简单常用的数据泵导出导入(expdp/impdp)命令举例(下)

    <Oracle简单常用的数据泵导出导入(expdp/impdp)命令举例(上)> <Oracle简单常用的数据泵导出导入(expdp/impdp)命令举例(下)> 目的:指导项 ...

  3. 使用Struts2和jQuery EasyUI实现简单CRUD系统(转载汇总)

    使用Struts2和jQuery EasyUI实现简单CRUD系统(一)——从零开始,ajax与Servlet的交互 使用Struts2和jQuery EasyUI实现简单CRUD系统(二)——aja ...

  4. Oracle简单的备份和恢复-导出和导入(1)

    ylbtech-Oracle:Oracle简单的备份和恢复-导出和导入(1) Oracle简单的备份和恢复-导出和导入 1. 用户导出自己的表(emp,dept)返回顶部 1.1, 我们启动Oracl ...

  5. Oracle简单的备份和恢复-导出和导入(2)

    ylbtech-Oracle:Oracle简单的备份和恢复-导出和导入(2) 简单的备份和恢复-导出和导入(2) 1. 用户导入导出文件中的一张表(emp)返回顶部 0.1, 我们在sql plus中 ...

  6. Oracle简单的备份和恢复-导入和导出-目录

    ylbtech-Oracle:Oracle简单的备份和恢复-导入和导出-目录 Oracle安全运行离不开良好的备份和恢复机制,因为我们不是DBA.所以我们也就不过多的讲解DBA的备份和恢复.作为程序员 ...

  7. oracle简单存储过程以及如何查看编译错误

    oracle简单存储过程以及如何查看编译错误; CREATE OR REPLACE PROCEDURE procedure_test ISval VARCHAR2(200);BEGIN /* val ...

  8. oracle 简单的sysTimeStamp类型转date 类型

    oracle  简单的SYSTIMESTAMP 类型转date 类型 SELECT SYSTIMESTAMP , SYSTIMESTAMP+0 FROM dual; SAMPLE_TIME ----- ...

  9. Oracle简单脚本演示样例

    Oracle简单脚本演示样例 1.添加表 --改动日期:2014.09.21 --改动人:易小群 --改动内容:新增採购支付情况表 DECLARE VC_STR           VARCHAR2( ...

随机推荐

  1. [转载]Black-Scholes 模型中 d1,d2 是怎么得到的?如何理解 Black-Scholes 模型?

    https://www.optbbs.com/thread-253244-1-1.html

  2. 如何通过代码设置WPF控件的字体,颜色

    this.lbTips.Foreground = new SolidColorBrush(Colors.Black); this.lbTips.FontFamily = new FontFamily( ...

  3. 关于window.onresize

    window.ss1 = function() { alert("aaa") } window.ss = function() { alert("bbb") } ...

  4. 音乐推荐与Audioscrobbler数据集

    1. Audioscrobbler数据集 数据下载地址: http://www.iro.umontreal.ca/~lisa/datasets/profiledata_06-May-2005.tar. ...

  5. 『TensorFlow』读书笔记_进阶卷积神经网络_分类cifar10_上

    完整项目见:Github 完整项目中最终使用了ResNet进行分类,而卷积版本较本篇中结构为了提升训练效果也略有改动 本节主要介绍进阶的卷积神经网络设计相关,数据读入以及增强在下一节再与介绍 网络相关 ...

  6. 『TensorFlow』读书笔记_Word2Vec

    由于暂时不会深入接触NLP相关领域,所以本章的内容就不过多涉及了,以后会进行学习,应该. Word2Vec又称Word Embeddings,中文称为"词向量"."词嵌入 ...

  7. ES6中export与export default的区别

    首先要知道export,import ,export default是什么 ES6模块主要有两个功能:export和importexport用于对外输出本模块(一个文件可以理解为一个模块)变量的接口i ...

  8. .Net Core2.1 部署到IIS

    1. 发布网站,和.net framework MVC一样 2.安装WindowsHosting和.Net Core SDK 下载地址:https://www.microsoft.com/net/do ...

  9. Eclipse+Spring boot开发教程

    一.安装 其实spring boot官方已经提供了用于开发spring boot的定制版eclipse(STS,Spring Tool Suite)直接下载使用即可,但考虑到可能有些小伙伴不想又多装个 ...

  10. QChart绘制折线区域

    效果图: 代码: // 创建折线上点的序列 QLineSeries *splineSeries = new QLineSeries(); //QSplineSeries *splineSeries = ...