当前位置:网站首页>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
边栏推荐
- 2022 low voltage electrician retraining question bank and online simulation examination
- The newline character with in the string is converted to an array
- 128. 最长连续序列-哈希表
- Jupyter notebook sets the default browser to open with an error syntaxerror: (Unicode error) 'UTF-8' codec can't decode byte 0xd4
- Union selector
- Priority issues
- The difference between deep copy and shallow copy
- [advanced pointer I] character array & array pointer & pointer array
- [untitled] task3 multiple recall
- [character set 9] will GBK be garbled when copied to unicode?
猜你喜欢

43 cas d'analyse du réseau neuronal MATLAB: chapitre 7 régression du réseau RBF - - réalisation de la régression fonctionnelle non linéaire

Inheritance of row height

【字符集八】char8_t、char16_t、char32_t、wchar、char

ip、DNS、域名、URL、hosts

torch.logical_and()方法
![[advanced pointer 2] array parameter transfer & pointer parameter transfer & function pointer & function pointer array & callback function](/img/90/447d601a8c338cdd5a6674a2dc59ae.png)
[advanced pointer 2] array parameter transfer & pointer parameter transfer & function pointer & function pointer array & callback function

【无标题】Task3 多路召回

Flink传入自定义的参数或配置文件

Handling abnormal data
![[compilation principle] understand BNF](/img/64/9a0e7507606781336fdc44116ba423.jpg)
[compilation principle] understand BNF
随机推荐
API处理Android安全距离
Problems that cannot be resolved by tar command
Background color translucent
UMI packaging and subcontracting, and compressing to gzip
2022.6.11-----leetcode.926
Background position position NOUN
[character set 8] char8_ t、char16_ t、char32_ t、wchar、char
在Tensorflow中把Tensor转换为ndarray时,循环中不断调用run或者eval函数,代码运行越来越慢!
Redis installation test
torch. logical_ And() method
Handling abnormal data
解压缩zip文件的工具类
Offer:[day 8 dynamic planning (simple)] --- > maximum profit of stock
Regular verification user name
torch.logical_and()方法
Background fixing effect
Shell基本语法--算数运算
Judge whether the object is empty
Loading font component loading effect
[advanced pointer 2] array parameter transfer & pointer parameter transfer & function pointer & function pointer array & callback function