SQL (Structured Query Language) II

Hello! Today, we will be diving further into SQL and the world of data in software applications. We will be using the Repl.it assignment here to start this lab with some practice using queries with JOINs and INDEX.

If you are finished with the lab code, here are some questions to think about:

  1. If we have some database, how do we know the relationships among the entities stored inside of it?
  2. Once we know that a relationship exists between certain entities, how do we implement that in our database?
  3. (regarding the books and authors tables) Can the IDs of the author and the book be the same? For example, if author_id is 1 and book_id is also 1 in the authored table, will there be a mix-up?
  4. If we have a lot of joint tables like this, wouldn’t that take up too much space?
  5. In the sea lions database, how are the IDs created? Do they come from the sea_lions table or the migrations table?
  6. If we are trying to join three tables, how can we know which the left or right tables are?
  7. When we join tables, does the resulting joined table get saved? Can we reference it later without joining again?
  8. There’s many different kinds of JOIN. Is there a default one we should use?