1、增

insert into 表 (列名,列名...) values (值,值,值...)
insert into 表 (列名,列名...) values (值,值,值...),(值,值,值...)
insert into 表 (列名,列名...) select (列名,列名...) from 表

2、删

delete from 表
delete from 表 where id=1 and name='alex'

3、改

update 表 set name = 'alex' where id>1

4、查

select * from 表
select * from 表 where id > 1
select nid,name,gender as gg from 表 where id > 1

5、其他

a、条件select * from 表 where id > 1 and name != 'alex' and num = 12;select * from 表 where id between 5 and 16;select * from 表 where id in (11,22,33)select * from 表 where id not in (11,22,33)select * from 表 where id in (select nid from 表)b、通配符select * from 表 where name like 'ale%'  - ale开头的所有(多个字符串)select * from 表 where name like 'ale_'  - ale开头的所有(一个字符)c、限制select * from 表 limit 5;            - 前5行select * from 表 limit 4,5;          - 从第4行开始的5行select * from 表 limit 5 offset 4    - 从第4行开始的5行d、排序select * from 表 order by 列 asc              - 根据 “列” 从小到大排列select * from 表 order by 列 desc             - 根据 “列” 从大到小排列select * from 表 order by 列1 desc,列2 asc    - 根据 “列1” 从大到小排列,如果相同则按列2从小到大排序e、分组select num from 表 group by numselect num,nid from 表 group by num,nidselect num,nid from 表  where nid > 10 group by num,nid order nid descselect num,nid,count(*),sum(score),max(score),min(score) from 表 group by num,nidselect num from 表 group by num having max(id) > 10特别的:group by 必须在where之后,order by之前f、连表无对应关系则不显示select A.num, A.name, B.namefrom A,BWhere A.nid = B.nid无对应关系则不显示select A.num, A.name, B.namefrom A inner join Bon A.nid = B.nidA表所有显示,如果B中无对应关系,则值为nullselect A.num, A.name, B.namefrom A left join Bon A.nid = B.nidB表所有显示,如果B中无对应关系,则值为nullselect A.num, A.name, B.namefrom A right join Bon A.nid = B.nidg、组合组合,自动处理重合select nicknamefrom Aunionselect namefrom B组合,不处理重合select nicknamefrom Aunion allselect namefrom B

摘抄自:https://www.cnblogs.com/wupeiqi/articles/5713315.html

MySQL-04:数据内容操作-增删改查-基本命令笔记相关推荐

  1. MySQL-06:pyMySQL增删改查基本命令笔记

    增 # 导入pymysql模块 import pymysql # 连接database conn = pymysql.connect(host="你的数据库地址", user=&q ...

  2. NodeJS里如何连接MySQL并分别操作增删改查

    本文简介 Node.js 里连接 MySQL ,并分别操作增删改查 . 你需要在电脑里安装一下 MySQL ,最好再安装一个数据库管理工具.我使用的是 MySQL Workbench ,这是一款 My ...

  3. mysql创建数据表列子,MySQL 创建数据库及简单增删改查

    MySQL 创建数据库及简单增删改查 我们可以在登陆 MySQL 服务后,使用 create 命令创建数据库,语法如下: CREATE DATABASE 数据库名; 登入: Enter passwor ...

  4. MySQL 之基础操作增删改查等

    一:MySQL基础操作 使用方法: 方式一: 通过图型界面工具,如 Navicat,DBeaver等 方式二: 通过在命令行敲命令来操作 SQL ( Structure query language ...

  5. 数据库的操作 增删改查 mysql

    数据库的操作 增删改查 mysql 登陆数据库 查看全部的数据库 系统提供的库,除了 test 是给我们练手的 其它的不要碰 mysql库,保存了系统重要内容,比如帐户 root帐户的用户名,密码,就 ...

  6. Node连接MySQL数据库进行基本的增删改查操作(一看就会)

    Node连接MySQL数据库进行基本的增删改查操作(一看就会) ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ...

  7. 用Python+Mysql+MDUI实现的数据库增删改查列表操作及单,多文件上传实例

    用Python+Mysql+MDUI实现的数据库增删改查列表操作及单,多文件上传实例.web服务用flask框架,数据库操作用的pymysql框架.教程在我B站有的. 开源地址:https://git ...

  8. MYSQL - database 以及 table 的增删改查

    MYSQL - database 以及 table 的增删改查 MySQL的相关概念介绍 MySQL 为关系型数据库(Relational Database Management System), 这 ...

  9. 1-1 MySQL数据库的基本操作 【增删改查】

    1-1 MySQL数据库的基本操作 [增删改查] 一.基础操作 创建数据库 查看数据库 选择数据库 删除数据库 二.建立一个基础数据库 三.基本操作 外键约束与字段自增 数据的增删改 数据查询 数据排 ...

最新文章

  1. easyexcel生成excel_阿里JAVA解析Excel工具easyexcel
  2. java 读取配置文件中的列表
  3. CTFshow php特性 web148
  4. 对计算机网络设备的认识,计算机入门知识:你有必要认识的网络设备及工具
  5. xMind思维导图软件如何合并多个导图
  6. python处理json文件_python读取json文件转成excel
  7. 通过反射访问private的属性或方法
  8. Spring Boot@Component注解下的类无法@Autowired的问题
  9. 两个年月下拉列表html,html年月日下拉联动菜单 年月日三下拉框联动
  10. 数据库大作业——基于C#和SQL Server的简单日常记账系统
  11. java url 长度限制_GET请求中URL的最大长度限制总结
  12. 大佬们用代码写的故事
  13. BZOJ4715 囚人的旋律
  14. uniapp支付宝登录获取用户信息
  15. ios实现类似魔兽小地图功能 在
  16. ABAP术语-BOR (Business Object Repository )
  17. Ubuntu(乌班图)修改阿里云镜像源详细步骤及安装gcc编译器
  18. 单目标跟踪OTB、VOT数据集介绍
  19. 生活中人们通过计算机网络进行信息交流,浅谈网络计算机应用
  20. 用户手册——机房收费系统

热门文章

  1. 性能测试组件CodeBenchmark V2发布
  2. .NET 6新特性试用 | 最小Web API
  3. oh,我的老伙计,你看看这近五十个dapr视频
  4. 记一次 .NET 某WMS仓储打单系统 内存暴涨分析
  5. 通过Dapr实现一个简单的基于.net的微服务电商系统(四)——一步一步教你如何撸Dapr之订阅发布...
  6. Windows Terminal 新手入门
  7. AgileConfig-轻量级配置中心 1.1.0 发布,支持应用间配置继承
  8. .NET Core + Kubernetes:Helm
  9. 你知道技术委员会吗?嗯,一个既重要却又鸡肋的神秘组织
  10. 使用 Azure Function 定时启动云 VM