当前位置:网站首页>Adding, deleting, modifying and querying MySQL tables (basic)
Adding, deleting, modifying and querying MySQL tables (basic)
2022-06-27 19:50:00 【The past days were like the wind_】

List of articles
- 1、 newly added (Create)
- 1.1、insert insert data
- 1.11、 requirement values() The number of fields in the header, the number of columns agreed in the header, and the type of each column , To match
- 1.12、 stay SQL To represent a string in , Both English and Chinese formats are acceptable ' ' , '' ''
- 1.13、 If a column is datetime( Time stamp ), How to match
- 1.14、insert During insertion , You can insert only one column or several columns , At this point, the other columns will adopt the default settings
- 1.15、 Chinese can also be inserted
- 1.16、 Insert more than one line at a time
- 2、 Look for statements select
- 3、MySQL Modification operation of
- 4、 Delete operation delect
1、 newly added (Create)
1.1、insert insert data
Create database 
Specify database
Create table 
See the table 
View table structure 
Insert code :
insert into Table name values ( The value of the column …);
Query table 

1.11、 requirement values() The number of fields in the header, the number of columns agreed in the header, and the type of each column , To match

matching 
1.12、 stay SQL To represent a string in , Both English and Chinese formats are acceptable ’ ’ , ‘’ ‘’
‘ This one can ’ “ This one is OK ”
1.13、 If a column is datetime( Time stamp ), How to match
1) Insert a specified time by specifying a format string
2) adopt now() Function to insert a Current system time
First of all, this table is in student in 
Specify time :
system time :
Query table ( Traverse ?):
1.14、insert During insertion , You can insert only one column or several columns , At this point, the other columns will adopt the default settings
1) Insert a column 
2) Insert some columns 
1.15、 Chinese can also be inserted

MySQL The default encoding is Latin 
The configuration scheme is in the notes
1.16、 Insert more than one line at a time


2、 Look for statements select
2.1、 Full column lookup
The most basic search , Full column lookup , Put all the columns of a table directly , And all the rows
select * from Table name ;
insert data :
Example full column lookup :
What you find here is a temporary table
All the tables in the database are on the hard disk But here in memory Release after output
2.2、 Specified column query
select Name … from Table name :
This query is more efficient
Targeted queries
The query here is also a temporary table " Release at any time "------> Release after printing
2.3、 Specifies that the query field is an expression
Queries are accompanied by operations 
Now query Chinese scores are ten more than usual
It's also a temporary table 
Three grades and
2.4、 Specify alias for query field
It is equivalent to a temporary table for query , New column names have been developed 
It's easy to get confused
2.5、 De duplication of query results distinct
For query results , Remove duplicate data 


The weight cannot be removed at this time
2.6、 Sort
For query results ( A temporary table ) Sort
select Name … from Table name order by Name asc/desc;
Descending 
Default ascending order For math scores 
asc Ascending 
Sorting empty values is considered the minimum value 
Sorting can also depend on expressions or aliases

Sort by alias 
It can also be used. order by Sort multiple columns
Now sort according to the first column , If the first column is the same , Then the next column , And so on 
2.7、select Conditional queries in
select Heel where+ Specific screening conditions
select Name from indicate where Conditions ;

where The following condition has nothing to do with the preceding column 
where Words and sentences cannot use aliases 


The expression also has and and or that and first

Cao mengde is not satisfied and
between------ Section 
What's the math score () Any value in can be queried — Fixed value query 

It can also be done through or To achieve the same purpose 
The use of wildcards 
2.8、 Paging query
Yes 8 That's ok 
We can set the number of search results on any page ( That's ok )
select * from exam_result limit Number of lines per page ;
select * from exam_result limit 3 offset 3;
select * from exam_result limit 3 offset Start with the line ;
3、MySQL Modification operation of
3.1、 Definition update operation
update exam_result set math = ‘80’ where name = ‘ The Monkey King ’;

3.2、 Screening operations limit
Top three filters 
Add and modify operations 


Revise the Chinese score to the original one 1/2
4、 Delete operation delect
delete from exam_result where id = 8;
边栏推荐
- Introduction to deep learning and neural networks
- DCC888 :Register Allocation
- MySQL初学者福利
- Oracle 获取月初、月末时间,获取上一月月初、月末时间
- Comment encapsuler un appel à une bibliothèque
- 昱琛航空IPO被终止:曾拟募资5亿 郭峥为大股东
- 数仓的字符截取三胞胎:substrb、substr、substring
- Erreur Keil de Huada Single Chip Computer La solution de Weak
- mime.type文件内容
- openssl客户端编程:一个不起眼的函数导致的SSL会话失败问题
猜你喜欢

华大单片机KEIL报错_WEAK的解决方案

OpenSSL client programming: SSL session failure caused by an obscure function

GIS remote sensing R language learning see here

Core dynamic Lianke rushes to the scientific innovation board: with an annual revenue of 170million yuan, Beifang Electronics Institute and Zhongcheng venture capital are shareholders

海底电缆探测技术总结

【登录界面】

A simple calculation method of vanishing point

爬取国家法律法规数据库

过关斩将,擒“指针”(下)

Mathematical derivation from perceptron to feedforward neural network
随机推荐
Character interception triplets of data warehouse: substrb, substr, substring
如何封装调用一个库
中金证券经理给的开户二维码安全吗?找谁可以开户啊?
NVIDIA Clara-AGX-Developer-Kit installation
Informatics Orsay all in one 1335: [example 2-4] connected block
【云驻共创】 什么是信息化?什么是数字化?这两者有什么联系和区别?
Cdga | what is the core of digital transformation in the transportation industry?
Running lantern experiment based on stm32f103zet6 library function
shell脚本常用命令(四)
OpenSSL client programming: SSL session failure caused by an obscure function
Redis 原理 - String
Current market situation and development prospect forecast of the global ductless heating, ventilation and air conditioning system industry in 2022
【云驻共创】高校数字化差旅建设“解决之道”
基础数据类型和复杂数据类型
Kotlin微信支付回调后界面卡死并抛出UIPageFragmentActivity WindowLeaked
Is it safe to buy stocks and open an account on the account opening link of the securities manager? Ask the great God for help
Embracing cloud Nativity: Practice of Jiangsu Mobile order center
现在网上买股票开户身份证信息安全吗?
Is the account opening QR code given by CICC securities manager safe? Who can I open an account with?
惊呆!原来 markdown 的画图功能如此强大!