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

Query and update animals table #2

Merged
merged 3 commits into from
Mar 3, 2023
Merged

Query and update animals table #2

merged 3 commits into from
Mar 3, 2023

Conversation

ONJoseph
Copy link
Owner

@ONJoseph ONJoseph commented Mar 3, 2023

-Hi Reviewer, In this part the following were implemented:

  • Add a column species of type string to your animals table. Modify your schema.sql file.
  • Insert the following data:
    Animal: His name is Charmander. He was born on Feb 8th, 2020, and currently weighs -11kg. He is not neutered and he has never tried to escape.
    Animal: Her name is Plantmon. She was born on Nov 15th, 2021, and currently weighs -5.7kg. She is neutered and she has tried to escape 2 times.
    Animal: His name is Squirtle. He was born on Apr 2nd, 1993, and currently weighs -12.13kg. He was not neutered and he has tried to escape 3 times.
    Animal: His name is Angemon. He was born on Jun 12th, 2005, and currently weighs -45kg. He is neutered and he has tried to escape once.
    Animal: His name is Boarmon. He was born on Jun 7th, 2005, and currently weighs 20.4kg. He is neutered and he has tried to escape 7 times.
    Animal: Her name is Blossom. She was born on Oct 13th, 1998, and currently weighs 17kg. She is neutered and she has tried to escape 3 times.
    Animal: His name is Ditto. He was born on May 14th, 2022, and currently weighs 22kg. He is neutered and he has tried to escape 4 times.
  • Remember to add these insertions to your data.sql file.
  • 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 the species columns went back to the state before the 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.
    Take a screenshot of the results of your actions.
    queries3
    queries4
    queries5
    queries6
    queries7
  • Now, take a deep breath and... Inside a
    transaction delete all records in the animals table, then roll back the transaction.
    After the rollback verify if all records in the animals table still exists. After that, you can start breathing as usual ;)
    Take a screenshot of the results of your actions.
    queries8
  • 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
    Take a screenshot of the results of your actions.
    queries9
    queries10
    queries11
    queries12
    queries13
  • Remember to add all these transactions to your queries.sql file.
  • Thanks.

Copy link

@mwanawabangona mwanawabangona left a comment

Choose a reason for hiding this comment

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

Hi @ONJoseph,

Your project is complete! There is nothing else to say other than... it's time to merge it :shipit:
Congratulations!

Highlights

  • No linter errors ✔️
  • Repo looks professional 💼
  • Solid pull request scroll
  • Good quality commits

Optional suggestions

Every comment with the [OPTIONAL] prefix won't stop the approval of this PR. However, I strongly recommend you to take them into account as they can make your code better. Some of them were simply missed by the previous reviewer and addressing them will really improve your application.

Cheers and Happy coding!

Feel free to leave any questions or comments in the PR thread if something is not 100% clear.
Please, remember to tag me in your question so I can receive the notification.


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.

@ONJoseph ONJoseph merged commit d8fd7d6 into dev Mar 3, 2023
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