Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save gisaac85/4388bc31232c5d54dd712b6e2453a785 to your computer and use it in GitHub Desktop.
Save gisaac85/4388bc31232c5d54dd712b6e2453a785 to your computer and use it in GitHub Desktop.
Extra database assignments

Extra assignments

Here are some extra assignments for everyone who has finished the database homework and couldn't get enough ;).

Indices

Indices are a very important feature to make queries faster.

  1. What is a database index? Explain in your own words.
  2. Considering the world database used in the assignments. Here's a query:

SELECT * FROM city WHERE Population > 5000000;

Which rows in the city table will the DBMS look at to answer your query?

  1. Indices can be implemented with a binary search tree. Draw a binary tree for the Population of the top 24 largest cities.
  2. Explain how the following query SELECT * FROM city WHERE Population > 5000000; will work when we set an index on the Population column. How does the database search the binary tree to answer the query?
  3. Pick a database schema and explain which columns you think should get an index and explain for each column why you think that's a good idea.
  4. Implement a binary search tree that stores numbers in NodeJS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment