MySQL Questions

1. MySQL - INDEXES? Answer: An index is a data structure that improves the speed of operations on a database table. Indexes, however, reduce the efficiency of INSERT and UPDATE operations on a table. This is because when we insert or update a data value in a table, indexes also need to be modified accordingly. So, they are not always appropriate to use. 2. Types of MySQL Indexes? Answer: Indexes can be defined on single or multiple columns of a MySQL table. The decision to add indexes on a table column(s) depends on the type of data that needs to be searched. MySQL provides the following types of indexes − Simple Index : A simple index is a basic type of index where the values inserted into the column, containing this index, are searched easily. In such case, the column can contain duplicate values or NULL. Unique Index : A Unique index does not allow any duplicate values to be inserted into a table column (where the index is defined on).It can be added to single or multiple columns of a table. Primary Key Index : Primary Key Index is an extension of unique index, as the primary key column must always contain unique values and these values must not be NULL. Fulltext Index : In a database, sometimes you would have to search for a blob of text instead of a record. You can use fulltext index for it. As its name suggests, it is used to make the text searches in a table easier. Descending Index : The descending index is only available in MySQL versions after 8.0. It is simple index used to store data in a reverse order. Using this index, it is easy to search for the latest values inserted into the database table.

Comments

Popular posts from this blog

Php Interview Questions for Freshers

Singleton in PHP

db socket in mysql