SQL: Elite Level SQL From The Ground Up (DIY SQL Book 4) by Keith Dvorjak

SQL: Elite Level SQL From The Ground Up (DIY SQL Book 4) by Keith Dvorjak

Author:Keith Dvorjak [Dvorjak, Keith]
Language: eng
Format: azw3
Published: 2018-09-28T16:00:00+00:00

Chapter 4: Indexes and Constraints

Whenever the data is inserted in a table in the database, the server simply places the data in the next available location within the file for that table. The data is not stored in any particular numeric or alphabetical order as you are likely to think. So, if you plan to retrieve data using SELECT statement then the server will carry out a table scan which means that it which check each row to check content and if a match is found the row will be added to the result set.

This type of a search may seem to be simple with the tables mentioned in the book because we have been dealing with tables having upto 20 rows of data. However, databases of various institutions like universities, stock exchange, banks, hospitals etc would have millions of rows of data and retrieving result in this manner can cause delay. In such cases indexes can help you out.

While reading a book, you would refer to the index for important information. So, basically index is used to find a particular piece of information. In books, the index is available at the end and lists the topics in an alphabetical order. In the same manner, the index in case of database keeps information sorted and organized. An Index is also a table however it not contain all the data of the entity instead it will contain only the columns that would be required to locate information.

Now, let’s try to create an index.


Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.