We have a sample table in our database which has a primary key. Let us check the indexes present in the table. Run the following query to check the index present in the table.
We get the following output once the query is executed.
Let us create another index on a table.
- CREATE INDEX In NameON Student(Name)
Execute the preceding script. Syntax for checking index on a table is given below.
By replacing the tablename with the actual table name it will give us the list of all the indexes present in the table. Let us check the same now. Execute the following script.
We can see that the new index created is present in the above result set. Let us now see how to delete the index we just created.
Syntax for deleting an Index
DROP INDEX <table name>.<index name>
Let us now delete the index that we just created. Execute the following script.
- DROP INDEX student.InName
Execute the query.
Let us run the query again just to verify there is no index present in the table.
As we can see the index created in the table is deleted.