当前位置:网站首页>Collation of MySQL error prone knowledge points (to be updated)
Collation of MySQL error prone knowledge points (to be updated)
2022-07-28 15:15:00 【Wang Xiaoxi WW】
Mysql Sorting out fallible knowledge points ( To be updated )
Note: Here, according to CSDN Mysql The skill tree Organized error prone questions , May refer to MySQL This one is enough ,MySQL Detailed study tutorial ( Recommended collection ),MySQL Novice tutorial
List of articles
One 、 Use of database
- Initial account (
create+grant), Reference resources mysql Create new users and authorize - mysql Sign in , Log on to the remote server , Reference resources MySQL Two login methods ,MySQL Login tutorial
Note:- If Joe Has been deployed on the development machine ssh service , So he No pass
mysql -h Joe Development machine address -u joe-p mysqlstay Use on any computer in the LAN . mysql -h IP Address -u user -p password -P portSign in .
- If Joe Has been deployed on the development machine ssh service , So he No pass
- Create and delete databases (
create database Database nameperhapsdrop ...) - Create table (create)
- Self increasing field (
id INT PRIMARY KEY AUTO_INCREMENT) - Delete table (
drop table Table name), Reference resources MySQL This one is enough - Database coding , Reference resources MySql Change the database code to UTF8,show create database grammar
- MySQL Storage engine , Ensure that the storage engine of the data table is
innodb, Reference resources MySQL Three common storage engines
Note:InnoDBSupport transactions and foreign keys , There are better Concurrency capability . to update ( Delete ) Operating frequency Also high , Or to ensure the integrity of the data , such as OA Automatic office system .MyISAMTransaction and foreign key are not supported , Simple structure , Can be compressed into Read only status . Mainly read write insertion Applications for , Like the blog system 、 News portal .MemoryThe engine saves the data in memory , Restart will lose data , Read fast, fast , For a Session table and cache surface .- Temporary tables are not necessarily used Memory engine :
- Memory temporary table Adopted yes
memoryStorage engine - Disk temp table Adopted yes
myisamStorage engine ( Disk temporary tables can also be usedinnodbStorage engine , adoptinternal_tmp_disk_storage_engineParameter to control which storage engine to use ,
frommysql5.7.6After that, it defaults toinnodbStorage engine , The previous version defaults tomyisamStorage engine
- Memory temporary table Adopted yes
Two 、 data type
- Implicit type conversion of values , Reference resources MySQL Implicit transformation of
Note:- If string starts with the a number , And all are numbers , Then the numerical result of conversion is the whole string ; Part of it is numbers , The result of the number conversion is until the first character that is not a number . such as
varchar str = "123dafa" // The conversion to a number is 123 DECIMAL(P,D):P Is the number of significant digits precision ,P The scope is1〜65,D Is said The number of digits after the decimal point ,D The range is0~30,MySQL requirement D Less than or equal to (<=)P such as DECIMAL(4,2), The value is 23.46.- For example, for
intType ofxandy,select id, (x^2 + y^2)/2 as result from points;OutputresultThe type isdecimaltype .
- If string starts with the a number , And all are numbers , Then the numerical result of conversion is the whole string ; Part of it is numbers , The result of the number conversion is until the first character that is not a number . such as
- Time default (
defaultconstraint , This questiondatetimeandtimestampWill do ), Reference resources MySQL Default constraint ,mysql datetime And timestamp difference - The text field ,MySQL in varchar and char difference ,MySQL Middle face VARCHAR and TEXT How to choose ?,mysql How many bytes does a character occupy
Note:varcharThe length of the type is variable , andcharThe length of the type is fixed , When defined aschar(10)when , Even if the inserted content isabc3 Characters , It will still occupy 10 Characters , Which includes 7 Storage space of empty characters .charMaximum length 255 Characters ,varcharMaximum length 65535 Characters ;varcharType of The search efficiency is relatively low , andcharThe search efficiency of type is relatively high , Therefore, variable length is usedvarchar, Fixed length usechar.MySQL 5.0.3A change in the version includesVARCHARThe maximum length of the field is from255Add characters to65,535Characters . This makesVARCHARThe type is more similar toTEXT. Although the two data types share Maximum length is65,535Characters , butVARCHARMedium VAR Indicates that you can set the maximum size to 1 To 65,535 Any value between .TEXTField The maximum fixed size is65,535Characters .MEDIUMTEXTUp to 16 MB String ,LONGTEXTUp to 4 GB String .
- Binary fields ( There is something wrong with this topic , You should use
mediumBlob), Reference resources MySQL Details of various types ( See the comments ),Blob Data type and application ,MySQL:BLOB And TEXT And its maximum storage limit
Note:blobUsed to store binary numbers , The maximum number of bytes is65535, That is, the maximum file size is65K; andvarcharThe maximum number of characters is65535.char,varchar,textIs based on characters ; andblobIs based on bytes , There is no character set .
3、 ... and 、 Data modification
Four 、 Data query
5、 ... and 、 Database composition
6、 ... and 、 Query advanced
7、 ... and 、 Built in functions
8、 ... and 、 Aggregation and grouping
Nine 、 Subquery
Ten 、 Link query
11、 ... and 、 Indexes
边栏推荐
- When MySQL uses left join to query tables, the query is slow because the connection conditions are not properly guided
- Instant experience | further improve application device compatibility with cts-d
- SQL labs detailed problem solving process (less1-less10)
- JS -- realize the rotation chart (complete function)
- 回编译失败
- Matlab load usage
- PS modify the length and width pixels and file size of photos
- Establish binary tree + C language code from preorder and middle order
- Shader顶点着色器修改顶点高度的一个思路
- Stack expression
猜你喜欢
随机推荐
Use of beefs
汇编学习
Wonderful frog -- how simple can it be to abandon the float and use the navigation bar set by the elastic box
idea调试burpsuit插件
Shell command
Iframe tag
CCSP international registered cloud security experts set up examination rooms in China
Node.js+express realizes the operation of MySQL database
安装mosek,license安装位置查找
3564. 日期类
Hard disk partition method
crmeb 标准版window+phpstudy8安装教程(二)
The second 1024, come on!
chrome插件调试
2021-09-02
Install pytorch geometric on colab, and libcudart.so.10.2 appears when importing the package
crmeb pro2.2即将增加的功能都有哪些?
Basic operation implementation of sequence table
Compilation failure caused by kotlin version upgrade
JS学习笔记24-28:结束








