当前位置:网站首页>Addition, deletion, modification and query of advanced MySQL data (DML)
Addition, deletion, modification and query of advanced MySQL data (DML)
2022-04-22 10:25:00 【JanYork_ Little Jane】
increase
INSERT INTO stu(studentNo, loginPwd, studentName, sex, gradeId, phone, address, bornDate, mail, identityCard) VALUE ('123456','00000',' Jane ',' Secret ','1','1888888888',' Changsha ','2000-1-1','[email protected]','43032000000000');
INSERT INTO Table name ( Field 1, Field 2) VALUE ( value 1, value 2);
-- If not numerical , Please use single quotation marks , Such as :(' value 1',' value 2')
Insert multiple rows
INSERT INTO Table name ( Field 1, Field 2) VALUE ( value 1, value 2),( value 1, value 2);
-- This allows you to insert multiple lines at once
Insert the results of the query into a new table
Format 1
INSERT INTO Table name ( Field 1, Field 2) SELECT Field 1, Field 2 FROM Original table name ;
-- There is no need to say more about the use methods and problems that will arise , Try it yourself
Format 2
SELECT Field 1, Field 2 INTO The new name of the table FROM Original table name ;
Delete
-- DELETE FROM Table name WHERE [ Conditions ];
-- WHERE [ Conditions ] Don't write , Not writing is to unconditionally delete all , Conditional is to delete the qualified !!!
DELETE FROM stu WHERE studentNo = '888888';
Delete all data in the table
-- TRUNCATE TABLE Table name ;
TRUNCATE TABLE stu;
Be careful : Use this statement to delete data in the table , Will reset auto increment , And the execution efficiency is better than DELETE.
Change
UPDATE statement we use UPDATE key word .
-- UPDATE Table name SET Field name = ' field value ', Field name = ' field value ' WHERE [ Conditions ]
-- WHERE [ Conditions ] Don't write , Not writing is unconditionally modifying all , Conditional is to modify what meets the conditions !!!
UPDATE stu SET studentNo = '888888' WHERE studentNo = '123456';
check
SELECT * FROM stu WHERE studentNo = '888888';
This is a simple query statement . ditto ,WHERE It can be omitted , If not WHERE Conditions , Is to unconditionally query all .
We can also write more complex .
SELECT * FROM stu WHERE studentNo = '888888' GROUP BY studentNo ORDER BY studentNo ASC ;
We decompose , Take a look one by one .
notes :[ ] Inner represents an unnecessary statement .
SELECT * or < List of field names > FROM < Table name or view > [WHERE < Query criteria >] [GROUP BY Fields to be grouped ] [ORDER BY Fields to sort [ASC or DESC] ] ;
*Express all .FROMAfter that, it is mainly connected with the data source , It can be single or multiple .WHEREFor conditional screening .GROUP BYYou can group the queried data according to the specified fields .HAVINGUsed to filter groups , Is forGROUP BYSeparate groups for screening and so on .ORDER BYUsed to sort , Sort by a column ,ASCIt's in ascending order ,DESCIt's in descending order
版权声明
本文为[JanYork_ Little Jane]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204221017171281.html
边栏推荐
- Qt关于信号槽连接出现的一些问题记录
- API 网关的功能用途及实现方式
- *CTF 2022 Reverse Writeup
- TIANTI 22 analog l3-2 puzzle a punch in reward (30 points)
- JWT source code analysis (four layer package with schematic diagram)
- idea写sparksql程序local[*]模式可以运行,提交到spark yarn运行出现ClassNotFoundException
- MySQL隐式转换案例一则
- 003-MySQL索引
- 5. Embedded controller (EC) learns PS / 2 protocol
- Cloud leopard intelligence, a DPU chip head enterprise, joined the openeuler community to help Digital China infrastructure
猜你喜欢

LLVM之父Chris Lattner:编译器的黄金时代

数字化时代,企业运维面临现状及挑战分析解读

OneFlow学习笔记:从Functor到OpExprInterpreter

分享几个 Sklearn 模块中不为人知又超级好用的 API 函数
![[issue 307] in terms of implementation principle, why is Nacos so strong?](/img/e0/61e837cd6cf3528252a721e9ec13a3.png)
[issue 307] in terms of implementation principle, why is Nacos so strong?

【课程汇总】Hello HarmonyOS系列课程,手把手带你零基础入门

绿色节能建筑已是大势所趋

頭條面試居然跟我扯了半小時的Semaphore

003-MySQL索引

ORACLE数据库查询锁表语句sql脚本,以及删除锁信息脚本(数据库开发ETL、DBA必备)
随机推荐
Laya Uncaught ReferenceError: spine is not defined
「笔记」某电信公司转型 SRE 运维体系交流
Analysis of image lazy loading (three implementation methods and two optimization methods)
CLA: silver bullet to reduce the compliance risk of open source community?
【FAQ】HMS Core推送服务与本地创建通知消息如何相互覆盖?
Oracle帐户被锁了解锁方法
MySQL数据库常识之储存引擎
Linux Installation Oracle 19C Full Version (graphics + silent installation)
LLVM之父Chris Lattner:编译器的黄金时代
About the problem that the picture library of tpshop open source mall version 6.0 does not display pictures
oracle中时间函数总结
Swoole high performance in memory database use and configuration tutorial
MySQL基础合集
How does Oracle use circular control keywords exit, goto, continue
Unity3D build时错误提示:Missing Project ID in Unity 解决方案
《MySQL 是怎样运行的:从根儿上理解 MySQL 》优质笔记
High quality notes on how MySQL works: understanding MySQL from the root
Golang time strings common methods
The root cause of Android's security vulnerability is Apple's lossless audio codec
Directory of message queuing Master Course