Thursday, April 18, 2019

SQL Database Objects

Database objects are used to store or reference data. Some of them are indexes, stored procedures, sequences, views and so on.

INDEXES :-

Indexes are of different types and they are as below

Single column index 
A single-column index is created based on only one table column.
The basic syntax is as follows.

CREATE INDEX INDEX_NAME ON TABLE_NAME (COLUMN_NAME);
OR
CREATE INDEX INDEX_EMP ON EMP1 (EMPNO);

Unique Indexes
A unique index does not allow any duplicate values to be inserted into the table. 
The basic syntax is as follows.

CREATE UNIQUE INDEX INDEX_EMPNO ON EMP1(EMPNO);

Composite Indexes
A composite index is an index on two or more columns of a table. 
Its basic syntax is as follows.

CREATE INDEX INDEX_EMPNO ON EMP1(EMPNO, ENAME);

Implicit Indexes
Implicit indexes are indexes that are automatically created by the database server when an object is created.

To Drop Index 
Drop index index_name;


No comments:

Post a Comment

Different types of indexes in SQL Server and Oracle

* What are the different types of indexes in Sql server and Oracle? Identify the differences. In SQL Server and Oracle, indexes are crucial ...