Skip to content

Commit 079e3a1

Browse files
committed
Indexing table challenges completed
1 parent e2900e6 commit 079e3a1

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# Challenges"
8+
]
9+
},
10+
{
11+
"cell_type": "markdown",
12+
"metadata": {},
13+
"source": [
14+
"- create b- tree index on the last and first name in the customers table\n",
15+
"- create a hash index on the product name in the products table"
16+
]
17+
},
18+
{
19+
"cell_type": "markdown",
20+
"metadata": {},
21+
"source": [
22+
"Solution:\n",
23+
"\n",
24+
"-- B tree index\n",
25+
"\n",
26+
"`CREATE INDEX idx_last_name_first_name_customers\n",
27+
"ON customers (last_name, first_name);`\n",
28+
"\n",
29+
"-- Hash index\n",
30+
"\n",
31+
"`CREATE INDEX idx_product_name_products\n",
32+
"ON products USING hash(product_name);`"
33+
]
34+
}
35+
],
36+
"metadata": {
37+
"kernelspec": {
38+
"display_name": "Python 3",
39+
"language": "python",
40+
"name": "python3"
41+
},
42+
"language_info": {
43+
"codemirror_mode": {
44+
"name": "ipython",
45+
"version": 3
46+
},
47+
"file_extension": ".py",
48+
"mimetype": "text/x-python",
49+
"name": "python",
50+
"nbconvert_exporter": "python",
51+
"pygments_lexer": "ipython3",
52+
"version": "3.8.5"
53+
}
54+
},
55+
"nbformat": 4,
56+
"nbformat_minor": 4
57+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-- B tree index
2+
CREATE INDEX idx_last_name_first_name_customers
3+
ON customers (last_name, first_name);
4+
5+
-- Hash index
6+
CREATE INDEX idx_product_name_products
7+
ON products USING hash(product_name);

0 commit comments

Comments
 (0)