From the course: Oracle Database 12c: Advanced SQL

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Creating indexes

Creating indexes - Oracle Database Tutorial

From the course: Oracle Database 12c: Advanced SQL

Start my 1-month free trial

Creating indexes

- [Instructor] Okay, enough talk, it's time for some action. Let's see how we can create indexes on our existing database tables. Creating indexes in the Oracle database is very straightforward and done via the create index command. So, for example, let's create an index on the salary column of our employees table. To do that I just type create index specifying the index name, for example emp_sal_idx. I can of course choose any name I desire on employees and then in parentheses the column on which you want the index to be created. So, salary in our case. Executing this command will create the index for us. Note that the name of the index is up to us but it has to be unique in the Oracle schema which we are connected to. Now that our index has been created, we don't have to do anything special for queries to start using it. For example, let's write a query that returns the employees who earn exactly $24,000, so I can type select star from employees where salary equals 24,000. The index…

Contents