Indexes in SQL

Instructor: David Gloag

David has over 40 years of industry experience in software development and information technology and a bachelor of computer science

Storing information in a database is a common practice these days. In this lesson, we'll take a look at a database technology, SQL, and an organizational technology that goes along with it, indexes.

Dealing with the Information Glut

We collect information. At times, it seems like it's all we do. We try to remember the birthdays of all of our family members and friends. Businesses capture contact information from people that might potentially buy their products and services. And everyone saves images and movies of significant events or vacations. Because of this, we need a way to store all of the information. But more than that, we need the means to access it quickly and efficiently. Fortunately, technology exists that can help do just that. Two examples of such technologies are SQL and Indexes.

What is SQL?

SQL is an acronym. It stands for Structured Query Language and it is the language used to make requests from a database management system. It was developed by IBM in the early 1970's and released as part of a commercial offering by Oracle in 1979. The language includes a series of commands for accessing and manipulating database information. Some common examples include:

  • SELECT - allows you to find information in the database.
  • INSERT - allows you to add information to the database.
  • UPDATE - allows you to change data that already exists in the database.
  • DELETE - allows you to remove information from the database.
  • CREATE - allows you to create a new object in the database, such as a table.

What is an Index?

An index is a list of values that provide an implied order to the elements in a database. Often, you need to search or sort information in a database to work with it. Indexes provide the means to perform these types of activities without physically changing the data.

The obvious question that arises here is why not just sort the information right in the database? The simple answer is that you could. But moving information around is expensive from a performance perspective. It is far more efficient to simply add new information to the end of the database and maintain the appropriate index.

Also, if the information needed to be traversed in multiple orders, the list would have to be reorganized multiple times, compounding the problem.

An Example

Let's look at an example. Say we have a database table where each row corresponds to a person. For each person, there is a column that contains their Name, Age, and Eye Color. The information in the table appears in the order it was captured. The table appears below:

Table & 3 Indexes

To unlock this lesson you must be a Member.
Create your account

Register to view this lesson

Are you a student or a teacher?

Unlock Your Education

See for yourself why 30 million people use

Become a member and start learning now.
Become a Member  Back
What teachers are saying about
Try it risk-free for 30 days

Earning College Credit

Did you know… We have over 200 college courses that prepare you to earn credit by exam that is accepted by over 1,500 colleges and universities. You can test out of the first two years of college and save thousands off your degree. Anyone can earn credit-by-exam regardless of age or education level.

To learn more, visit our Earning Credit Page

Transferring credit to the school of your choice

Not sure what college you want to attend yet? has thousands of articles about every imaginable degree, area of study and career path that can help you find the school that's right for you.

Create an account to start this course today
Try it risk-free for 30 days!
Create an account