Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/query multiple tables #6

Open
wants to merge 12 commits into
base: temp
Choose a base branch
from

Conversation

OmarRamoun
Copy link
Owner

Changes Introduced ♻️

✔️ Create a table named owners with the following columns:

attribute value
id integer (set it as autoincremented PRIMARY KEY)
full_name string
age integer

✔️ Create a table named species with the following columns:

attribute value
id integer (set it as autoincremented PRIMARY KEY)
name string

✔️ Modify animals table:

  • Make sure that id is set as autoincremented PRIMARY KEY
  • Remove column species
  • Add column species_id which is a foreign key referencing species table
  • Add column owner_id which is a foreign key referencing the owners table

✔️ Insert the following data into the owners table:

 owner_id |    full_name    | age
----------+-----------------+-----
        1 | Sam Smith       |  34
        2 | Jennifer Orwell |  19
        3 | Bob             |  45
        4 | Melody Pond     |  77
        5 | Dean Winchester |  14
        6 | Jodie Whittaker |  38

✔️ Insert the following data into the species table:

 species_id |  name
------------+---------
          1 | Pokemon
          2 | Digimon

✔️ Modify your inserted animals to include owner information (owner_id):

  • Sam Smith owns Agumon.
  • Jennifer Orwell owns Gabumon and Pikachu.
  • Bob owns Devimon and Plantmon.
  • Melody Pond owns Charmander, Squirtle, and Blossom.
  • Dean Winchester owns Angemon and Boarmon.

✔️ Write queries (using JOIN) to answer the following questions:

  • What animals belong to Melody Pond?
  • List of all animals that are pokemon (their type is Pokemon).
  • List all owners and their animals, remember to include those that don't own any animal.
  • How many animals are there per species?
  • List all Digimon owned by Jennifer Orwell.
  • List all animals owned by Dean Winchester that haven't tried to escape.
  • Who owns the most animals?

Copy link

@omar-labana omar-labana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved ✔️

Hi @MrRamoun

Congratulations on completing this project! 👏🏼 🎉

You have correctly implemented all of the requirements📃 correctly and without any errors⚠️ or bugs🪲.

Cheers and good luck in your next milestones! 🍀

Feel free to leave any questions or comments in the PR thread(don't forget to tag me 😄) if something is not 100% clear.


As described in the Code reviews limits policy you have a limited number of reviews per project (check the exact number in your Dashboard). If you think that the code review was not fair, you can request a second opinion using this form.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants