当前位置:网站首页>Basic statement of MySQL (1) - add, delete, modify and query
Basic statement of MySQL (1) - add, delete, modify and query
2022-07-27 07:01:00 【Ultimate xiaoteng】
Preface
MySQL Because of its small size 、 Fast 、 Low total cost of ownership , Especially open source , Generally, the development of small and medium-sized websites and large-scale websites all choose MySQL As website database .
So I'm going to record several commonly used sentences here ;
Each statement only introduces how to operate , Then I will write a comprehensive .
Build table
-- Delete user surface
drop table if exists user;
-- establish user surface
create table user
(
-- id Primary key
id int primary key auto_increment,
-- full name
name varchar(20),
-- Gender
sex varchar(20),
-- Age
age int,
-- mailbox
email varchar(100)
);
We can go straight to Navicat for MySQL Click in the database and create a new query , Copy the above code and run .
After running, we will get an initial data table .
Next, let's perform some operations .
Add sentences
Format :inser into Table name ( Field 1, Field 2, Field 3……)values( value 1, value 2, value 3……)
Separated by commas , Each field corresponds one by one .
for example : insert into user (id,name,sex,age,email) values(null,' Zhang San ',' male ',21,'[email protected]')
Be careful , If the type is varchar Need to be enclosed in quotation marks
After performing 
Delete
Basically, deletion statements are deleted according to conditions .
So format :delete from Table name where Conditions
For example, according to id Delete :delete from user where id =3

modify
Basically, delete statements are also operated according to conditions , But also bring in the value to be modified .
So format :update Table name set data where Conditions
For example, according to id modify name: update user set name = ' Brother Qiang ' where id = 4 ;

Inquire about
ad locum , Only show query all
sentence : select * from Table name select * from user 
Summary
Only one example of each operation is written here , There are many more , Write after you understand it thoroughly .
边栏推荐
- R2LIVE代码学习记录(3):对雷达特征提取
- FTX US launched FTX stocks, striding forward to the mainstream financial industry
- 智能安防视频平台EasyCVR出现通道列表为空情况的原因是什么?
- Matlab drawing (ultra detailed)
- Analysis of pix2pix principle
- Add virtual network card and configure OP route in win10
- Derivative, partial derivative and gradient
- Inventory of the world's six most technologically competent smart contract audit companies in 2022
- 脱氧核糖核酸DNA修饰氧化锌|DNA修饰纳米金颗粒|DNA偶联修饰碳纳米材料
- deepsort源码解读(七)
猜你喜欢

Two ways of multi GPU training of pytorch

VIVO应用市场APP上架总结

ES6新特性(入门)

硫化镉CdS量子点修饰脱氧核糖核酸DNA|CdS-DNA QDs|近红外CdS量子点偶联DNA规格信息

如何删除或替换EasyPlayer流媒体播放器的loading样式?

EasyRecovery14数据恢复软件官方功能简介

Analysis of pix2pix principle

Account management and authority

regular expression

What if the website server is attacked? Sunflower tips that preventing loopholes is the key
随机推荐
MangoDB
Problems related to compilation and training of Darknet yolov3 and Yolo fast using CUDA environment of rtx30 Series graphics card on win10 platform
【12】 Understand the circuit: from telegraph to gate circuit, how can we "send messages from thousands of miles"?
Linux Installation and uninstallation of MySQL
Ftx.us launched stock and ETF trading services to make trading more transparent
Sunflower teaches you how to prevent denial of service attacks?
Record of pychart running jupyter notebook in virtual environment
基于SSM医院预约管理系统
仿真模型简单介绍
基于SSM学生学籍管理系统
PNA polypeptide PNA TPP | GLT ala ala Pro Leu PNA | suc ala Pro PNA | suc AAPL PNA | suc AAPM PNA
齐岳:巯基修饰寡聚DNA|DNA修饰CdTe/CdS核壳量子点|DNA偶联砷化铟InAs量子点InAs-DNA QDs
ES6的新特性(2)
The problem of torch loading custom models
Variance and covariance
基于SSM实现的校园新闻发布管理系统
CentOS上使用Docker安装和部署Redis
Account management and authority
Use -wall to clear code hidden dangers
肽核酸PNA-多肽PNA-TPP|Glt-Ala-Ala-Pro-Leu-pNA|Suc-Ala-Pro-pNA|Suc-AAPL-pNA|Suc-AAPM-pNA