Author: admin
-
MySQL Show Indexes
We can get the index information of a table using the Show Indexes statement. This statement can be written as: In the above syntax, we can see that if we want to get the index of a table, it requires to specify the table_name after the FROM keyword. After the successful execution of the statement, it will…
-
MySQL Drop Index
MySQL allows a DROP INDEX statement to remove the existing index from the table. To delete an index from a table, we can use the following query: If we want to delete an index, it requires two things: The Drop Index syntax contains two optional options, which are Algorithm and Lock for reading and writing…
-
How to Create Index in MySQL
An index is a data structure that allows us to add indexes in the existing table. It enables you to improve the faster retrieval of records on a database table. It creates an entry for each value of the indexed columns. We use it to quickly find the record without searching each row in a database table…
-
MySQL INSERT INTO SELECT
Sometimes we want to insert data of one table into the other table in the same or different database. It is not very easy to enter these data using the INSERT query manually. We can optimize this process with the use of MySQL INSERT INTO SELECT query. It allows us to populate the MySQL tables…
-
MySQL INSERT IGNORE
Insert Ignore statement in MySQL has a special feature that ignores the invalid rows whenever we are inserting single or multiple rows into a table. We can understand it with the following explanation, where a table contains a primary key column. The primary key column cannot stores duplicate values into a table. For example, student_roll_number should always be unique…
-
MySQL INSERT ON DUPLICATE KEY UPDATE
The Insert on Duplicate Key Update statement is the extension of the INSERT statement in MySQL. When we specify the ON DUPLICATE KEY UPDATE clause in a SQL statement and a row would cause duplicate error value in a UNIQUE or PRIMARY KEY index column, then updation of the existing row occurs. In other words, when we…
-
MySQL REPLACE
The REPLACE statement in MySQL is an extension of the SQL Standard. This statement works the same as the INSERT statement, except that if an old row matches the new record in the table for a PRIMARY KEY or a UNIQUE index, this command deleted the old row before the new row is added. This…
-
MySQL SELECT Statement
The SELECT statement in MySQL is used to fetch data from one or more tables. We can retrieve records of all fields or specified fields that match specified criteria using this statement. It can also work with various scripting languages such as PHP, Ruby, and many more. SELECT Statement Syntax It is the most commonly used SQL query. The general…
-
MySQL DELETE Statement
MySQL DELETE statement is used to remove records from the MySQL table that is no longer required in the database. This query in MySQL deletes a full row from the table and produces the count of deleted rows. It also allows us to delete more than one record from the table within a single query, which…
-
MySQL UPDATE Query
MySQL UPDATE query is a DML statement used to modify the data of the MySQL table within the database. In a real-life scenario, records are changed over a period of time. So, we need to make changes in the values of the tables also. To do so, it is required to use the UPDATE query.…