当前位置:网站首页>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 .
边栏推荐
- Do it yourself container
- Introduction to the official functions of easyrecovery14 data recovery software
- Day012 一维数组的应用
- A cross domain problem of golang
- Express framework
- 基于SSM医院预约管理系统
- Pytorch uses data_ Prefetcher improves data reading speed
- Use -wall to clear code hidden dangers
- How to avoid loopholes? Sunflower remote explains the safe use methods in different scenarios
- Explanation of server related indicators
猜你喜欢

FTX US launched FTX stocks, striding forward to the mainstream financial industry

基于SSM图书借阅管理系统

【12】 Understand the circuit: from telegraph to gate circuit, how can we "send messages from thousands of miles"?

Pytorch uses data_ Prefetcher improves data reading speed

工控用Web组态软件比组态软件更高效

regular expression

Qi Yue: thiol modified oligodna | DNA modified cdte/cds core-shell quantum dots | DNA coupled indium arsenide InAs quantum dots InAs DNA QDs

What is the reason why dragging the timeline is invalid when playing device videos on the easycvr platform?

Two ways of multi GPU training of pytorch

CdS quantum dots modified DNA | CDs DNA QDs | near infrared CdS quantum dots coupled DNA specification information
随机推荐
Explanation of server related indicators
Pytorch uses data_ Prefetcher improves data reading speed
Add virtual network card and configure OP route in win10
Disk management and file system
vscode运行命令报错:标记“&&”不是此版本中的有效语句分隔符。
基于SSM实现的校园新闻发布管理系统
Record of pychart running jupyter notebook in virtual environment
DNA修饰贵金属纳米颗粒|脱氧核糖核酸DNA修饰纳米金(科研级)
Express接收请求参数
jest单测样式问题【identity-obj-proxy】npm包
MySql数据库
Sunflower teaches you how to prevent denial of service attacks?
Use -wall to clear code hidden dangers
Many of the world's top 500 enterprises gathered at the second digital Expo, and the digital industry curtain is about to open!
MangoDB
Redis fast learning
事件捕获方式和冒泡方式—它们的区别是什么?
【11】 Binary code: "holding two roller handcuffs, crying out for hot hot hot"?
Future, futuretask and completable future are often asked in interviews
基于SSM音乐网站管理系统