- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
insert into [表名] values (对应的列的数据);
注:插入的字段的数目和类型需要和表结构中要求的一致
insert into [表名] (若干个指定列) values (对应的列的数据);
根据需要只插入其中的某几列
insert into [表名] values (对应的列的数据) , (对应的列的数据)......;
select * from [表名];
注 : *是一个通配符,意思是把所有的列都查找出来.
select [列名] from [表名];
select [列名] as [别名] from [表名];
注: as可以省略.
select distinc [若干个列名] from [表名];
order by 指定针对哪个列进行排序
注: 默认为升序 . ASC 为升序(从小到大) DESC 为降序(从大到小)
select * from [表名] order by [列名] (asc 或 desc);
select name,chinese + math + english from exam_result order by chinese + math + english desc;
select name,chinese + math + english as total from exam_result order by total desc;
先把所有同学信息按照语文降序排序,再按照数学降序排序,再按照英语降序排序.
select * from exam_result order by chinese desc,math desc,english desc;
运算符 | 说明 |
---|---|
>, >=, <, <= | 大于,大于等于,小于,小于等于 |
= | 等于,NULL 不安全,例如 NULL = NULL 的结果是 NULL |
<=> | 等于, NULL 安全,例如 NULL <=> NULL 的结果是 TRUE(1) |
!=, <> | 不等于 |
BETWEEN a0 AND a1 | 范围匹配, [a0, a1],如果 a0 <= value <= a1,返回 TRUE(1) |
IN (option, …) | 如果是 option 中的任意一个,返回 TRUE(1) |
IS NULL | 是 NULL |
IS NOT NULL | 不是 NULL |
LIKE | 模糊匹配。 % 表示任意多个( 包括 0 个)任意字符; _ 表示任意一个字符 |
算符 | 说明 |
---|---|
AND逻辑与 | 多个条件必须都为 TRUE(1),结果才是 TRUE(1) |
OR 逻辑或 | 任意一个条件为 TRUE(1), 结果为 TRUE(1) |
NOT逻辑取反 | 条件为 TRUE(1),结果为 FALSE(0) |
错误的写法 null = null
正确写法:
select * from exam_result where chinese <=> null;
select * from exam_result where chinese is null;
select * from exam_result where english < 60;
select * from exam_result where chinese > english ;
where 中不能使用别名
select name,chinese + math + english as total from exam_result where chinese + math + english > 200;
select * from exam_result where chinese > 80 and english > 80;
select * from exam_result where chinese > 80 or english > 80;
注: AND的优先级高于OR,在同时使用时,需要使用小括号()包裹优先执行的部分
select * from exam_result where chinese between 80 and 90;
select * from exam_result where chinese >= 80 and chinese <= 90;
select * from exam_result where math in (45.0,60.0);
select * from exam_result where math = 45.0 or math = 60.0;
select * from exam_result where name like '孙%';
select * from exam_result where name like '孙_';
select * from exam_result where chinese like '9%';
-- 从 0 开始,筛选 n 条结果
SELECT ... FROM table_name [WHERE ...] [ORDER BY ...] LIMIT n;
-- 从 s 开始,筛选 n 条结果
SELECT ... FROM table_name [WHERE ...] [ORDER BY ...] LIMIT s, n;
-- 从 s 开始,筛选 n 条结果,比第二种用法更明确,建议使用
SELECT ... FROM table_name [WHERE ...] [ORDER BY ...] LIMIT n OFFSET s;
select name,chinese + math + english as total from exam_result order by total desc limit 3;
select name,chinese + math + english as total from exam_result order by total desc limit 3 offset 3;
select name,chinese + math + english as total from exam_result order by total desc limit 10 offset 3;
select name,chinese + math + english as total from exam_result order by total desc limit 3 offset 100;
update [表名] set [列名] = [修改的值], [列名] = [修改的值] where 子句;
update exam_result set math = 80 where name = '孙悟空';
update exam_result set math = 50,chinese = 95 where name = '曹孟德';
mysql> update exam_result set chinese = chinese - 10 ;
mysql> update exam_result set math = math + 10 order by chinese + math + english asc limit 3;
delete from [表名] where [筛选条件];
我试图理解基数排序,但在理解实现实际代码时改 rebase 数时遇到问题。这是我用来学习基数排序的代码,我会尝试解释我不明白的地方。 此代码由 GeeksForGeeks 提供: // C++ imp
话不多说,请看代码: ? 1
本文实例讲述了mysql语句实现简单的增、删、改、查操作。分享给大家供大家参考,具体如下: 1、创建db_shop数据库,如果该数据库不存在则创建 ?
使用oracle触发器 实现对某个表的增改删的监控操作,并记录到另一个表中。 代码: 复制代码代码如下: create or replace trigger test_trigge
java连接数据库增、删、改、查工具类 数据库操作工具类,因为各厂家数据库的分页条件不同,目前支持Mysql、Oracle、Postgresql的分页查询 在Postgresql环境测试过了,其他
1、修改数据 复制代码代码如下: DataRow dr =
注册表可以用来进行存储一些程序的信息,例如用户的权限、或者某些值等,可以根据个人需要进行存储和删减。 当前注册表主目录: 引用包 Wesky.Net.OpenTools 1.0.5或
是否可以将 pdf 页面的页眉更改为与当前所选书签同名的名称?我正在为我的 pdf 生成使用 Flying Saucer 。你能举个例子吗?提前致谢。 最佳答案 这对我适用于 flyingsaucer
好家伙,写后端,这多是一件美逝. 关于这个项目的代码前面的博客有写 我的第一个独立项目 - 随笔分类 - 养肥胖虎 - 博客园 (cnblogs.com
准备工作: 增、删、改、查的方法有很多很多种,这里只展示出常用的几种。 ?
需要5个类: 1.实体类:Person.java 2.抽象类:SQLOperate.java(封装了对数据库的操作) 3.助手类:DBOpenHelper.java(继承SQLiteOpenH
首先是是一个简单的例子,单链表的建立和输出。 程序1.1 复制代码 代码如下: #include<iostream> #include<string> using na
数据库操纵基本流程为: 1、连接数据库服务器 2、选择数据库 3、执行SQL语句 4、处理结果集 5、打印操作信息 其中用到的相关函数有 •resource m
我需要为 iPad 和 iPhone 设置不同颜色的标签,我知道我们可以为不同的尺寸类别更改字体大小,但是有什么方法可以根据尺寸类别的值设置不同的颜色 我知道有可用的代码解决方案,但我想知道 size
假设我有一个物体相对于相机的坐标 X、Y、Z 和方向 Rx、Ry、Rz。此外,我有这个相机在世界上的坐标 U、V、W 和方向 Ru、Rv、Rw。 如何将对象的位置(位置和旋转)转换为其在世界中的位置?
CRUD是Create(创建)、Read(读取)、Update(更新)和Delete(删除)的缩写,它是普通应用程序的缩影。如果您掌握了某框架的CRUD编写,那么意味可以使用该框架创建普通应用程序了
项目结构: 添加页面: &
本文实例讲述了android操作sqlite数据库(增、删、改、查、分页等)及listview显示数据的方法。分享给大家供大家参考,具体如下: 由于刚接触android开发,故此想把学到的基础知识
总括 pandas的索引函数主要有三种: loc 标签索引,行和列的名称 iloc 整型索引(绝对位置索引),绝对意义上的几行几列,起始索引为0 ix 是 iloc 和 loc的合体 at
我是一名优秀的程序员,十分优秀!