数据库操作的资料: 链接: https://pan.baidu.com/s/1dFl3q6X 密码: nvy7

-- 增:insert into 表名 (列名) values (值)
insert into Test (id,name) values (7,'dew') -- 删:表名 where 列名=值
delete Test where id=3 -- 查:select 列名 from 表名 where 列名=值
select id from Test -- 查询所有信息:select * from 表名
select * from Test -- 使用别名查询之一:select 列名 as 别名 from 表名
select id as ab from Test -- 使用别名查询之二:select 表的别名.列名 as 列的别名 from 表名 表的别名
select a.name as goodName from Test a -- 区间查询:select * from 表名 where 列名 Between 值 and 值
select * from Test where id Between 3 and 5 -- 指定查询:select * from 表名 where 列名 in(指定的值,指定的值,指定的值)
select * from Test where id in(3,5,6) -- 模糊查询:select * from 表名 where 列名 like 含有的字符(_代表一个占位符,%表示任意字符)
select * from Test where name like '_a%' -- 去重复查询:select distinct 列名,列名 from 表名
select distinct id ,name from Test -- 降序:select * from 表名 order by 列名 desc
select * from Test order by id desc -- 升序:select * from 表名 order by 列名 asc
select * from Test order by id asc -- 改:update 表名 set 列名=新值 where 列名=值
update Test set id=5 where id=2 -- 拼接用||(比较少用)
select 'id'|| 'name' from Test

-- 查找两个表中ID相等的
select a.id, a.name,b.math from stu a,scores b where a.id = b.id

-- 右外连接
select b.id, a.name,b.math from stu a,scores b where a.id(+) = b.id
select b.id, a.name,b.math from stu a right outer join scores b on a.id = b.id

-- 左外连接
select a.id, a.name,b.math from stu a,scores b where a.id = b.id(+)
select a.id, a.name,b.math from stu a left outer join scores b on a.id = b.id

-- 满外连接
select a.id,b.id, a.name,b.math from stu a full outer join scores b on a.id = b.id

-- 最大值
select max(scores.math) from scores

-- 最小值
select min(scores.math) from scores

-- 平均值
select avg(scores.math) from scores

-- 和
select sum(scores.math) from scores

-- 列数
select count(scores.math) from scores

-- 标准差
select stddev(scores.math) from scores

-- 分组函数
select math from scores group by math

SQL 的简单命令(增删改查)的更多相关文章

  1. 使用JDBC分别利用Statement和PreparedStatement来对MySQL数据库进行简单的增删改查以及SQL注入的原理

    一.MySQL数据库的下载及安装 https://www.mysql.com/ 点击DOWNLOADS,拉到页面底部,找到MySQL Community(GPL)Downloads,点击 选择下图中的 ...

  2. 通过JDBC进行简单的增删改查

    通过JDBC进行简单的增删改查(以MySQL为例) 目录 前言:什么是JDBC 一.准备工作(一):MySQL安装配置和基础学习 二.准备工作(二):下载数据库对应的jar包并导入 三.JDBC基本操 ...

  3. 通过JDBC进行简单的增删改查(以MySQL为例) 目录

    通过JDBC进行简单的增删改查(以MySQL为例) 目录 前言:什么是JDBC 一.准备工作(一):MySQL安装配置和基础学习 二.准备工作(二):下载数据库对应的jar包并导入 三.JDBC基本操 ...

  4. Java通过JDBC进行简单的增删改查(以MySQL为例)

    Java通过JDBC进行简单的增删改查(以MySQL为例) 目录: 前言:什么是JDBC 一.准备工作(一):MySQL安装配置和基础学习 二.准备工作(二):下载数据库对应的jar包并导入 三.JD ...

  5. MyBatis学习--简单的增删改查

    jdbc程序 在学习MyBatis的时候先简单了解下JDBC编程的方式,我们以一个简单的查询为例,使用JDBC编程,如下: Public static void main(String[] args) ...

  6. 初试KONCKOUT+WEBAPI简单实现增删改查

    初试KONCKOUT+WEBAPI简单实现增删改查 前言 konckout.js本人也是刚刚接触,也是初学,本文的目的是使用ko和asp.net mvc4 webapi来实现一个简单增删改查操作.Kn ...

  7. python3.6 使用 pymysql 连接 Mysql 数据库及 简单的增删改查操作

    1.通过 pip 安装 pymysql 进入 cmd  输入  pip install pymysql   回车等待安装完成: 安装完成后出现如图相关信息,表示安装成功. 2.测试连接 import ...

  8. python操作三大主流数据库(2)python操作mysql②python对mysql进行简单的增删改查

    python操作mysql②python对mysql进行简单的增删改查 1.设计mysql的数据库和表 id:新闻的唯一标示 title:新闻的标题 content:新闻的内容 created_at: ...

  9. 使用Mongoose类库实现简单的增删改查

    使用Mongoose类库实现简单的增删改查 Mongoose是在nodejs环境中对MongoDB数据库操作的封装,一种对象模型工具,可以将数据库中的数据转换为javascript对象供我们使用. M ...

  10. BitAdminCore框架应用篇:(二)创建一个简单的增删改查模块

    NET Core应用框架之BitAdminCore框架应用篇系列 框架演示:http://bit.bitdao.cn 框架源码:https://github.com/chenyinxin/cookie ...

随机推荐

  1. jquery循环绑定事件

    <html> <head> <title></title> <script type="text/javascript" sr ...

  2. [转]EF 4.1 Code First

    这篇文章介绍Code First开发以及如何与DbContext API一起使用.Code First允许使用C#或VB.NET类定义模型,在类或属性上有选择性的执行额外的配置或者使用Fluent A ...

  3. android ListView详解继承ListActivity

    [转]http://www.cnblogs.com/allin/archive/2010/05/11/1732200.html 在android开发中ListView是比较常用的组件,它以列表的形式展 ...

  4. what a fuck postgre update sql

    ================= what a fuck postgre update sql ================= UPDATE temp_group_temp set group_ ...

  5. 捕获JS 错误日志

    最近在做项目的过程中,发现很多JS报错没有引起重视,我就想想把JS错误捕获了,然后展示在我们一个平台上 具体实现代码: window.onerror = function(message, url,  ...

  6. 【git】删除某个文件的所有历史记录,批量删除远程分支

    删除git某个文件的所有历史记录 git的目的就是版本控制,记录每一个版本的变动.然而有的时候我们往往希望从版本库中彻底删除某个文件,不再显示在历史记录中.例如不小心上传了一堆错误的文件,或者不小心上 ...

  7. 使用第三方分页AspNetPager实现真正分页的SQL原理

    AspNetPager是一个第三方分页第三方控件,可以和数据绑定控件(GridView等)方便的结合,实现真分页. 真分页:从数据库中获取符合要求的部分数目的记录.性能较高,数据量小,网络负载小,对数 ...

  8. 位与(&)常用编程技巧

    补充知识:1)正整数的补码与原码相同:                2)求负整数的补码:原码 符号位不变,数值位各位取反,最后整个数加1得到补码:                3)按位与& ...

  9. 2014-4-25 运行号:837344 ASCII码排序

    #include <iostream> #include <cstdio> #include <cstdlib> #include <string> # ...

  10. strlen

    char c1[] = "sdfa";//系统自动添加结束字符 \0 char c2[] = {'1','2','3'};//这样赋值的话,要自己加上结束字符 \0 printf( ...