From the course: Advanced SQL for Application Development
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Solution: Defining B-tree and hash indexes
From the course: Advanced SQL for Application Development
Solution: Defining B-tree and hash indexes
(upbeat music) - [Instructor] Okay, the first part of the solution to the indexing challenge is to sue the CREATE INDEX command, followed by a name of an index, and then the term ON, followed by the name of the table, in this case, customers. And then we have a USING clause, and we'd say, USING B-tree, because we want this to be a B-tree index. And then we specify a list of the attributes that we want in the index. In this case, it's last name and first name. Now, not surprisingly, creating a hash index is similar. The solution there is again to use the CREATE INDEX command, specifying a name of the index, and then the ON clause, in this case it would be ON products, and then the USING clause, this cause we would be using hash, and again, followed by the list of attributes, but we only have one attribute that we're indexing in this case and that's product name. So that's the solution to the index challenge.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Overview of index types2m 26s
-
(Locked)
Using B-tree indexes and range scans2m 6s
-
Using hash indexes and equality operations1m 32s
-
(Locked)
Covering indexes2m 23s
-
(Locked)
Indexes and bulk data loading2m 18s
-
(Locked)
Avoiding index locks3m 3s
-
(Locked)
Challenge: Define a B-tree and a hash index37s
-
(Locked)
Solution: Defining B-tree and hash indexes57s
-
(Locked)
-
-
-
-
-