0% found this document useful (0 votes)
11 views

Lecture 7 - Table Indexes

Java

Uploaded by

Quốc Lê
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
11 views

Lecture 7 - Table Indexes

Java

Uploaded by

Quốc Lê
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 12
TABLE INDEXES _beamingGoals Vreate Indexes to improve query retrieval speed By the end of this lecture students should be able to: automatically generate sequence numbers by using a sequence generator V create, maintain, and use View Why use indexe: F2S » An index in database is similar to an index in a book > Indexes in database help speed up search queries. Allow find data in a table without scanning the entire table. 7 $2 want bananas... PPA wo) &* o CREATE TABLE doo PhoneBook LasiName FirsName PhoneNumber varchariS0) NOT NULL, varchariS0) NOT NULL, varchariS0) NOT NULL eae CREATE TABLE doo PhoneBook LastName varchar(50) NOT NULL, FirsName _varchar(50) NOT NULL, PhoneNumber —varchar(50) NOT NULL Result: 783-555-0110 ble Indexes (1s 2S » There are 2 types of major Indexes: — Clustered + Data is stored in the order on the clustered index + Only 1 clustered index per table + Usually the Primary Key + Sort and store the data rows in the table based on their key value. - Non-clustered + Data is not stored in the order on the non clustered index + Have a structure completely separate from the data rows. CREATE CLUSTERED INDEX IX PhoneBook_Cl ‘ON dbo PhoneBook (LastName, FirstName) Non - Clustered Index Creating an Index » Create a new index: CREATE INDEX index_name » Deleting an Index (eee 2S Academy eternal Use 10 v Table Indexes — Why use indexes? — Create, maintain and use index 2S Academy eternal Use es 25 Thank you aS Academy ternal se

You might also like