当前位置:网站首页>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
边栏推荐
- 3564. Date category
- Three pain points of software development! How to solve the applet container?
- Node.js+express realizes the operation of MySQL database
- What are the main threats to cloud security
- 3588. Permutation and binary
- How to gracefully encapsulate anonymous inner classes (DSL, high-order functions) in kotlin
- Picture Trojan principle production prevention
- redis常用命令总结(自备)
- Development status of security and privacy computing in China
- 知识产权相关的风险评估要怎么做
猜你喜欢

Slider restore and validation (legal database)

idea调试burpsuit插件

滑块还原和验证(法律数据库)

Mysql使用left join连表查询时,因连接条件未加索引导致查询很慢

PS how to crop photos

The difference between @notnull, @notblank, @notempty of commonly used verification annotations

Bcompare key expired or bcompare license key revoked

Establishment and traversal of binary tree (implemented in C language)

Word creates a title list with automatic numbering

经典Dijkstra与最长路
随机推荐
滑块还原和验证(法律数据库)
即刻体验 | 借助 CTS-D 进一步提升应用设备兼容性
手摸手实现Canal如何接入MySQL实现数据写操作监听
Drawing method using GL under URP
使用cpolar发布树莓派网页(apache2的安装测试)
7/13(水塘抽样)
MySQL authorization method
全开源免费的客服系统来了
When MySQL uses left join to query tables, the query is slow because the connection conditions are not properly guided
3540. Binary search tree
The automatic prompt of vs code code is missing - a tick to solve it
Partition and index of Oracle Database
听说crmeb多商户增加了种草功能?
Install pytorch geometric on colab, and libcudart.so.10.2 appears when importing the package
day 7/12
Matlab load usage
3715. 最少交换次数
Why do enterprises need user autonomous digital identity
SSRF vulnerability
Chapter I Introduction