当前位置:网站首页>MySQL - CRUD operations
MySQL - CRUD operations
2022-08-02 02:12:00 【Xiaolock830】
增
That is, a new row is added to the selected table in the database
全部插入
insert into 表名 values(值1,值2 ...);
Insert selected columns
insert into 表名(指定列名1, 指定列名2...) values(值1, 值2...);
删
That is, delete a row from the selected table in the database
delete from 表名;
我们可以用whereKeywords to filter the condition of the column we want to delete
delete from 表名 where 条件;
需要注意的是,在MySQL中,Our logical operator sumJava与CLanguage is different,Some common situations are listed below.
操作符含义
| 运算符 | 含义 |
|---|---|
| > ,>=,<,<= | Consistent with normal logic |
| = | 和C语言不同,MySQLIn the judgment of equality, use single equals |
| <=> | Determine whether both sides arenull,都为null返回true |
| !=, <> | 不等于 |
| between a and b | 判断是否在>= a , <= b的范围内 |
| in(a , b, c…) | 判断是否为a,b,c中的一个 |
| is null | 判断是否为null,是则返回ture |
| is not null | 判断是否为null,是则返回false |
| like | 模糊查询,%表示·多个字符,_表示单个字符 |
| and | 相当于&& |
| or | 相当于|| |
| not | 相当于~ |
查
select 查询范围 form 表名;
We can use it in the query scope position*,It means that we want to query all the data
select * form 表名;
同样的,我们也可以用whereto filter our query criteria
select * form 表名 where 筛选条件;
去重
我们可以用distinctkeyword to deduplicate the query results
select distinct 查询范围 from 表名;
排序
我们可以用order by关键字来对查询结果进行排序
升序
select 查询范围 from 表名 order by asc;
降序
select 查询范围 from 表名 order by desc;
别名
We can alias query results
select header expression 别名 from 表名;
分页
When our query data volume is too large,We can query page by page like a browser
使用关键字limit
select * from 表名 limit Limit the number of displays;
我们用offset进行翻页,The default first page offset is 0
select * from 表命 limit Limit the number of displays offset 偏移量;
改
update 表名 set 表头 = 表达式 where 条件;
需要注意的是,Our data operations are very dangerous,一定要小心谨慎
边栏推荐
- The Paddle Open Source Community Quarterly Report is here, everything you want to know is here
- Fundamentals of Cryptography: X.690 and Corresponding BER CER DER Encodings
- typeof in typescript32-ts
- Constructor instance method inheritance of typescript37-class (extends)
- 软件测试 接口自动化测试 pytest框架封装 requests库 封装统一请求和多个基础路径处理 接口关联封装 测试用例写在yaml文件中 数据热加载(动态参数) 断言
- YGG Guild Development Plan Season 1 Summary
- 【 wheeled odometer 】
- MySQL8 download, start, configure, verify
- messy website
- [LeetCode Daily Question] - 103. Zigzag Level Order Traversal of Binary Tree
猜你喜欢

Use baidu EasyDL implement factory workers smoking behavior recognition

typescript30 - any type

MySQL optimization strategy

Scheduled tasks for distributed applications in Golang

Multi-Party Threshold Private Set Intersection with Sublinear Communication-2021:解读

AWR分析报告问题求助:SQL如何可以从哪几个方面优化?

typeof in typescript32-ts
A full set of common interview questions for software testing functional testing [open thinking questions] interview summary 4-3

Constructor of typescript35-class

nacos startup error, the database has been configured, stand-alone startup
随机推荐
[Server data recovery] Data recovery case of server Raid5 array mdisk disk offline
Multi-Party Threshold Private Set Intersection with Sublinear Communication-2021: Interpretation
用位运算为你的程序加速
Safety (2)
LeetCode刷题日记:53、最大子数组和
Rust P2P Network Application Combat-1 P2P Network Core Concepts and Ping Program
Redis Subscription and Redis Stream
NIO‘s Sword(牛客多校赛)
2022-08-01 反思
LeetCode刷题日记:34、 在排序数组中查找元素的第一个和最后一个位置
Understand the big model in seconds | 3 steps to get AI to write a summary
Check if IP or port is blocked
搜罗汇总的效应
Golang分布式应用之定时任务
Project Background Technology Express
云和恩墨:让商业数据库时代的价值在openGauss生态上持续繁荣
messy website
密码学的基础:X.690和对应的BER CER DER编码
『网易实习』周记(三)
Golang分布式应用之Redis