1:N Lookup

Tags
Challenge
No

Earlier, you made your own version of the wombat app. Let's reuse that.

Find a 1:N relationship you can add to your current table. A common one is a category. For example:

  • Shoes have a manufacturer, where each shoe has one manufacturer, but a manufacturer can make more than one product. Same for cars, and other made things.
  • Movies have one rating, but more than one movie has a particular rating.
  • Books have one publisher, but a publisher publishes more than one book.
  • Courses are offered by one department, but a department offers more than one course.

Make a table for the category with at least three columns:

  • Id (e.g., manufacturer id, course id). INT, autoincrement, PK.
  • Name. VARCHAR, you choose the length.
  • Notes or comment. TEXT

Add a foreign key field to your original table. E.g., shoes might have a manufacturer column.

Add data to your new table. Add links to your original table.

Write an app that GETs the name of a entity from your original table (movie, shoe, course, whatevs), and shows the name of the category, and notes for that category. Like the doggo app takes the name of a doggo, and shows its household.

(Hint: URLs can't have spaces. Use + instead, as in: /url?var=foo+bar)

Submit your URL (one that includes a name to look up), and a zip of your files.

Where referenced