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

DB Challenges / Javier Flores #50

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

DB Challenges / Javier Flores #50

wants to merge 9 commits into from

Conversation

jffc-dev
Copy link

  • Implemented the getCurrentAmount function to avoid code repetition across multiple exercises.
  • Created the generateMovement stored procedure to simulate a movement, including all required validations.

Copy link

@fabio248 fabio248 left a comment

Choose a reason for hiding this comment

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

Good solution overall, and nice you formatted your queries that help when you are reading. I left some comments about improvements, only exercise 5 of the second challenge has to be solved differently.
A general comment when you assign the table's name after the FROM statement I prefer to use the 3 letters that help when you read the query.
We'll talk about your ERD solution in the feedback meeting.

src/answers.sql Outdated Show resolved Hide resolved
src/answers.sql Outdated Show resolved Hide resolved
INNER JOIN states AS S ON O.state_id = S.id
INNER JOIN countries AS C ON O.country_id = C.id
WHERE S.name = 'Colorado'
AND C.name = 'United States';
Copy link

Choose a reason for hiding this comment

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

nit: We do not need the country name in the WHERE statement since we know the state name is unique.

Copy link
Author

Choose a reason for hiding this comment

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

I initially had that approach, but when I reviewed the schema, I noticed there was no unique constraint on the name field in the state table.

src/answers.sql Outdated Show resolved Hide resolved
src/answers.sql Outdated Show resolved Hide resolved
src/answers-challenge2.sql Show resolved Hide resolved
src/answers-challenge2.sql Outdated Show resolved Hide resolved
src/answers-challenge2.sql Outdated Show resolved Hide resolved
Comment on lines +96 to +97
-- 5
-- Using a store procedure that simulates a movement
Copy link

Choose a reason for hiding this comment

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

issue: in this exercise at the begging said In this part, you need to CRATE A TRANSACTION with the following steps, and within that transaction, you have to develop each literal

src/answers-challenge2.sql Show resolved Hide resolved
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