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 and upate animals table #5

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from

Conversation

OmarRamoun
Copy link
Owner

Changes Introduced ♻️

✔️ Add a new column to the animals table with the following attributes:

attribute value
name species
type string

✔️ Insert the following data:

 id |    name    | date_of_birth | escape_attempts | neutered | weight_kg | species
----+------------+---------------+-----------------+----------+-----------+---------
  7 | Pikachu    | 2021-01-07    |               1 | f        |     15.04 | pokemon
  9 | Charmander | 2020-02-08    |               0 | f        |        11 | pokemon
 11 | Squirtle   | 1993-04-02    |               3 | f        |     12.13 | pokemon
 14 | Blossom    | 1998-10-13    |               3 | t        |        17 | pokemon
 15 | Ditto      | 2022-05-14    |               4 | t        |        22 | pokemon

✔️ Write queries for the following:

  • ✅ Inside a transaction:

    • Update the animals table by setting the species column to unspecified.
    • Verify that change was made.
    • Then roll back the change and verify that species columns went back to the state before transaction.
  • ✅ Inside a transaction:

    • Update the animals table by setting the species column to digimon for all animals that have a name ending in mon.
    • Update the animals table by setting the species column to pokemon for all animals that don't have species already set.
    • Commit the transaction.
    • Verify that change was made and persists after commit.
  • ✅ Inside a transaction:

    • delete all records in the animals table, then roll back the transaction.
    • After the roll back verify if all records in the animals table still exist.
  • ✅ Inside a transaction:

    • Delete all animals born after Jan 1st, 2022.
    • Create a savepoint for the transaction.
    • Update all animals' weight to be their weight multiplied by -1.
    • Rollback to the savepoint
    • Update all animals' weights that are negative to be their weight multiplied by -1.
    • Commit transaction

✔️ Write queries to answer the following questions:

  • How many animals are there?
  • How many animals have never tried to escape?
  • What is the average weight of animals?
  • Who escapes the most, neutered or not neutered animals?
  • What is the minimum and maximum weight of each type of animal?
  • What is the average number of escape attempts per animal type of those born between 1990 and 2000?

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