Indexes and Views in SQL
Indexes and Views in SQL
Indexes are special lookup tables that the database search engine can use to speed up data retrieval.
Simply put, an index is a pointer to data in a table. An index in a database is very similar to an index
in the back of a book.
Syntax:
Single-Column Indexes:
Unique Indexes:
Composite Indexes:
A composite index is an index on two or more columns of a table. Its basic syntax is as follows.
An index can be dropped using SQL DROP command. Care should be taken when dropping an index
because the performance may either slow down or improve.
Although indexes are intended to enhance a database's performance, there are times when they
should be avoided.
The following guidelines indicate when the use of an index should be reconsidered.
Syntax:
CREATE VIEW view_name AS
SELECT column1, column2.....
FROM table_name
WHERE [condition];
Delete View:
Drop view viewname;