当前位置:网站首页>MySQL introduction - crud Foundation (establishment of the prototype of the idea of adding, deleting, changing and searching)
MySQL introduction - crud Foundation (establishment of the prototype of the idea of adding, deleting, changing and searching)
2022-07-07 08:26:00 【Ghost Knight】
List of articles
CRUD
create,read,update,delete
- Insert sentence ( Add data )
- Update sentence ( UPDATE statement )
- Delete sentence ( Delete data )
- Select sentence ( Find data )
Insert sentence
Introductory cases
details
Update sentence
Introductory cases
details
- UPDATE Syntax to update columns in the original table row with new values .
- SET Clause to indicate which columns to modify and which values to give .
- WHERE Clause specifies which rows should be updated . If not WHERE Clause , Then update all
That's ok ( Record ), So the teacher reminds you to be careful .
4. If you need to modify multiple fields , Can pass set Field 1 = value 1, Field 2- value …
update employee set salary = salary + 1000,job = ' Mountain patrolling ' where name = ' Old monster '
Delete sentence
Introductory cases
details
- If not used where Clause , All data in the table... Will be deleted .( Be careful )
- Delete Statement cannot delete a - The value of the column ( You can use update Set to null perhaps ’ ')
- Use delete Statement only delete records , Don't delete the table itself . To delete a table , Use droptable sentence .drop table Table name ;
drop table employee;
Select sentence 【 a key 】( Single table , Multiple tables )
matters needing attention
- Select Specify which columns of data to query .
- column Specifies the column name .
- * Number means to query all columns .
- From Specify which table to query .
- DISTINCT Optional , When the result is displayed , Whether to remove duplicate data
Case practice
Create student table first
CREATE TABLE student (
id INT NOT NULL DEFAULT 1,
NAME VARCHAR ( 20 ) NOT NULL DEFAULT '',
chinese FLOAT NOT NULL DEFAULT 0.0,
english FLOAT NOT NULL DEFAULT 0.0,
math FLOAT NOT NULL DEFAULT 0.0
);
INSERT INTO student
VALUES
( 1, ' Taotao ', 98, 78, 90 );
INSERT INTO student
VALUES
( 2, ' Zhang Fei ', 87, 50, 80 );
INSERT INTO student
VALUES
( 3, ' Guan yu ', 91, 28, 30 );
Expression column
as sentence ( nickname )
Case practice
where Clause common operators
Case practice 1
Case practice 2
Order by Clause
Basic introduction
- Order by Specify sorted columns , The sorted column can be either the column name in the table , It can also be select The column name specified after the statement
- Asc Ascending [ Default ]、Desc Descending
- ORDER BY Clause should be in SELECT End of statement
Case presentation
边栏推荐
- OpenVSCode云端IDE加入Rainbond一体化开发体系
- [step on the pit series] H5 cross domain problem of uniapp
- Practice of combining rook CEPH and rainbow, a cloud native storage solution
- Train your dataset with swinunet
- Call pytorch API to complete linear regression
- Rainbond 5.6 版本发布,增加多种安装方式,优化拓扑图操作体验
- [quick start of Digital IC Verification] 14. Basic syntax of SystemVerilog learning 1 (array, queue, structure, enumeration, string... Including practical exercises)
- 发挥创客教育空间的广泛实用性
- ZCMU--1396: 队列问题(2)
- Analyzing the influence of robot science and technology development concept on Social Research
猜你喜欢
随机推荐
JS copy picture to clipboard read clipboard
[quick start of Digital IC Verification] 14. Basic syntax of SystemVerilog learning 1 (array, queue, structure, enumeration, string... Including practical exercises)
Uniapp mobile terminal forced update function
Register of assembly language by Wang Shuang
Splunk子查询模糊匹配csv中字段值为*
雅思考试自己的复习进度以及方法使用【日更版】
Practice of combining rook CEPH and rainbow, a cloud native storage solution
数据中台落地实施之法
Obsidan之数学公式的输入
Quick analysis of Intranet penetration helps the foreign trade management industry cope with a variety of challenges
The simple problem of leetcode is to judge whether the number count of a number is equal to the value of the number
Deit learning notes
漏洞复现-easy_tornado
Using nocalhost to develop microservice application on rainbow
Use of out covariance and in inversion in kotlin
一种适用于应用频繁测试下快速查看Pod的日志的方法(grep awk xargs kuberctl)
Interactive book delivery - signed version of Oracle DBA work notes
Splunk query CSV lookup table data dynamic query
Rainbow version 5.6 was released, adding a variety of installation methods and optimizing the topology operation experience
The truth of robot education in hands-on practice