1. Advantages and Disadvantages of IndexesAdvantages: fast retrieval, faster grouping and sorting Disadvantages: Occupies storage space and reduces data table modification operations 2. Classification of Indexes
3. Rules for using indexes1. Situations suitable for indexing
2. Situations where indexing is not suitable
3. Index failure
4. SQL about index1. Add index when creating table -- Add an index when creating a table -- INDEX keyword -- myindex Index name you choose yourself -- (username(16)) to which column to add it CREATE TABLE mytable( ID INT NOT NULL, username VARCHAR(16) NOT NULL, INDEX myindex (username(16)) ); 2. Add index after creating table -- Add index -- myindex index name (self-defined) -- mytable table name CREATE INDEX myindex ON mytable(username(16)); or ALTER TABLE mytable ADD INDEX myindex(username); 3 View index -- mytable table name show index FROM mytable; 4. Delete index -- myindex index name (self-defined) -- mytable table name DROP INDEX myindex ON mytable; or ALTER TABLE mytable DROP INDEX myindex; SummarizeThis is the end of this article about the advantages and disadvantages of indexing and the use of rules for advanced MySQL learning. For more relevant MySQL advanced indexing content, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Example of how to modify styles via CSS variables
>>: A brief discussion on the problem of Docker run container being in created state
When developing a website, you often need to use ...
Many friends who have just started to make web pag...
MySQL paging queries are usually implemented thro...
The span tag is often used when making HTML web pa...
1. Prerequisites We use the require.context metho...
Word MySQL 8.0 has been released for four years s...
1.1 General marking A general tag consists of an ...
In a table, you can define the color of the upper...
Preface: As far as I know, currently CSS can only...
1. SHOW PROCESSLIST command SHOW PROCESSLIST show...
Effect principle Mainly use CSS gradient to achie...
The installation tutorial of MySQL 5.7.19 winx64 ...
Table of contents 1. Install dependencies 2. Conf...
background When performing a SQL query, I tried t...
As the title says, otherwise when the page is revi...