当前位置:网站首页>MySQL learning record - II. MySQL create table command
MySQL learning record - II. MySQL create table command
2022-06-12 08:58:00 【Uncertain factors】
Create table command
1.1 Sign in
[[email protected]]# mysql -u root -p
Enter password:****** # Enter the terminal after logging in
mysql> create DATABASE RUNOOB;
// establish
CREATE DATABASE Database name ;
1.2 Create database
CREATE TABLE table_name (column_name column_type);
mysqladmin -u root -p create < Database name >
Enter password:******
1.3 Delete database
drop Command to delete the database
drop database < Database name >;
mysqladmin Delete database
mysqladmin -u root -p drop Database name
// Check the data
desc emo
// Show the bank
show linesize
// Set line payment
set linesize 120
// Set column width
col ename for a8
col sal for 999
/
mysql Index means
1.Unique Set non repeatable fields ( unique index );
2.Normal Speed up query ( General index );
3.Full Text Article segment query ( Full-text index );
Index method

1.B-Tree
B-Tree Is the most common type of index , All worth ( Indexed columns ) It's all sorted out , The distance from each leaf node to the following node is equal . therefore B-Tree It is suitable for finding data in a certain range , And it can directly support data sorting (ORDER BY)
B-Tree stay MyISAM The form and Innodb not quite the same :
MyISAM The table data file and the index file are separate , The index file only stores the disk address of the data record
InnoDB The table data file itself is the primary index , Leaf nodes data Domain holds complete data records
2.HASH
1. Support only "=",“IN" and ”<=>" Precise query , Can't use range query :
because Hash Index comparison is to carry out Hash After the operation Hash value , So it can only be used for equivalent filtering , Can't be used for range based filtering , Because after the corresponding Hash After algorithm processing Hash
2. Sort is not supported :
because Hash What the index stores is the process Hash After calculation Hash value , and Hash The magnitude of the value does not necessarily relate to Hash The key value before the operation is exactly the same , So the database can't use the index data to avoid any sort operation
3. Table scanning cannot be avoided at any time :
because Hash Index comparison is to carry out Hash After the operation Hash value , So even if you meet someone Hash Number of records of key value data , I can't go from Hash Direct query in index , You still need to access the actual data in the table for corresponding comparison , And get the corresponding result
4. High retrieval efficiency , The index can be retrieved at one time , Unlike B-Tree The index needs to be from the root node to the branch node , Finally, you can access the page node for many times IO visit , therefore Hash The query efficiency of index is much higher than B-Tree Indexes
5. Only Memory The engine supports explicit Hash Indexes , But it's Hash yes nonunique Of , Too many conflicts will also affect the search performance .Memory The default index type of the engine is Hash Indexes , Although it also supports B-Tree Indexes
mysql Index these three ,nomal The most commonly used ,full text Generally used in article search ,Unique Generally, it means that it cannot be reused
How to optimize database :
1. Choose a unique index
2. Order for frequent need 、 Index fields for grouping and combining operations
3. Index fields that are often used as query criteria
4. Limit the number of indexes
5. Try to use indexes with less data
6. Try to use prefixes to index
7. Delete indexes that are no longer or rarely used
Reference article : https://www.cnblogs.com/maowenqiang/p/10383835.html
边栏推荐
- Chapter IV - first procedure
- IP, DNS, domain name, URL, hosts
- Technology cloud report: how will the industrial Internet rebuild the security boundary in 2022?
- (十二)交互组件Selectable
- mySql学习记录——三、mysql查询语句
- Dynamic segment tree leetcode six hundred and ninety-nine
- ip、DNS、域名、URL、hosts
- Use NVM to dynamically adjust the nodejs version to solve the problem that the project cannot be run and packaged because the node version is too high or too low
- 【字符集六】宽字符串和多字节字符互转
- List < string > sort
猜你喜欢
![[advanced pointer I] character array & array pointer & pointer array](/img/ea/150b2162e4e1641eee7e852935d101.png)
[advanced pointer I] character array & array pointer & pointer array

Notes used by mqtt (combined with source code)
![(node:22344) [DEP0123] DeprecationWarning: Setting the TLS ServerName to an IP address is not permit](/img/c1/d56ec09663857afa52f20848aeadac.png)
(node:22344) [DEP0123] DeprecationWarning: Setting the TLS ServerName to an IP address is not permit

2022 low voltage electrician retraining question bank and online simulation examination

Popular understanding of time domain sampling and frequency domain continuation

通俗理解时域采样与频域延拓

Oracle installation details (verification)

利用nvm动态调整nodejs版本,解决因为node版本过高或过低导致项目无法运行和打包
![[new planning]](/img/8e/0e15e0f3ee08002eaceea1fe8948ec.jpg)
[new planning]

Loading circling effect during loading
随机推荐
第三章 寄存器 (内存访问)
ISCSI详解(五)——ISCSI客户端配置实战
【字符集六】宽字符串和多字节字符互转
Adjust SVG width and height
MySQL - Import / export operation
[sklearn] lightgbm
Domain name mapping to specified IP
128. 最長連續序列-哈希錶
POI library update excel picture
【字符集九】gbk拷贝到Unicode会乱码?
ERROR 1630 (42000): FUNCTION a.avg does not exist. Check the ‘Function Name Parsing and Resolution‘
(十二)交互组件Selectable
sql中的Exists用法
Knowledge points of 2022 system integration project management engineer examination: project cost management
Priority issues
[character set 7] what are the wide character codes and multi byte codes of Chinese characters
Regularization to limit the number of digits after the decimal point of an input number
Redis installation test
2022 melting welding and thermal cutting test questions and answers
torch.logical_and()方法