MySQL FAQs
FAQs Categories
Client Server Commands
Database Structure
Table Types or Storage Engines
Indexes
SQL Statements
Table Joins
Funtions and Operators
Tricky Select Queries
Speed Up Queries
Data Back Up
General Questions
Errors
N.M.P.L. Company www.NearMePayday.Loan || 3-month (90 days)
Powered by MySQL
 
Home / Indexes / Question No: 138

What is single column index or key in MySQL?

I intends to use indexes in MySQL to make SELECT queries faster.  I am not much clear about single column index.  Can you explain, what is single column index or key in MySQL?

Answer No: 138

MySQL allows to create single column index and multi-column index to facilitate quick retrieval of desired data.  A single-column normal index should be used if a particular column in your table will be the focus of a considerable number of your SELECT queries. Suppose an buyers profile table consists of four columns: a unique id, first name, last name and email address. You know that the majority of the searches will be specific to either the buyers ís last name or the email address. You should create one normal index for the last name and a unique index for the email address. Take an example by creating table namely buyers which has single column indexes:

CREATE TABLE buyers(
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
first_name VARCHAR(35) NOT NULL, last_name VARCHAR(35) NOT NULL,
email VARCHAR(55) NOT NULL UNIQUE,/* applying unique key index */
INDEX (last_name),/* applying normal index */
PRIMARY KEY(id)
);

Related MySQL FAQs to the Above FAQ

How-to-get-existing-indexes-of-the-table-in-MySQL How to get existing indexes of the table in MySQL?

What-is-index-terminology-or-concept-and-how-does-index-work-in-MySQL What is index terminology or concept and how does index work in MySQL?

How-many-types-of-indexes-or-keys-are-in-MySQL How many types of indexes or keys are in MySQL?

What-is-multi-column-index-or-key-in-MySQL What is multi column index or key in MySQL?

What-is-partial-column-and-prefixed-column-index-or-key-in-MySQL What is partial-column and prefixed-column index or key in MySQL?

When-does-multi-column-index-come-into-use-in-MySQL When does multi column index come into use in MySQL?

What-are-best-practices-to-pick-columns-to-index What are best practices to pick columns to index?

What-are-advantages-and-disadvantages-of-indexes-in-MySQL What are advantages and disadvantages of indexes in MySQL?

How-to-remove-or-drop-indexes-in-MySQL How to remove or drop indexes in MySQL?

Is-it-possible-to-apply-more-than-one-keys-on-a-single-column Is it possible to apply more than one keys on a single column?

What-is-foreign-key-in-MySQL What is foreign key in MySQL?

About FAQs: Recently Added FAQs

About MySQL FAQs: Site Map | Bookmark Us | Recommend this Site to Your Friend | Contact Us

Useful Links: Wikipedia.org | Oracle.com | w3schools.com | www.php.net | Github.com

© 2021  www.mysqlfaqs.net
All rights reserved.