WM | N/A | Saleh Yousef| Sprint 2| Big Spender#7
WM | N/A | Saleh Yousef| Sprint 2| Big Spender#7SalehOumar wants to merge 4 commits intoCodeYourFuture:mainfrom
Conversation
Big-Spender/readme.md
Outdated
| ```sql | ||
| INSERT YOUR QUERY HERE | ||
| Select * from spends | ||
| Where transaction_no Between 30000 And 31000; |
There was a problem hiding this comment.
Not quite correct here - at the moment when i run this query I get a empty table, but I should be seeing all transactions that spent ammounts between £30,000 and £31,000 - have a look again at this query.
Big-Spender/readme.md
Outdated
| Select transaction_no, expense_area | ||
| from spends | ||
| Join expense_areas | ||
| On spends.expense_area_id = expense_areas.id | ||
| Where expense_area ILIKE 'Better Hospital Food'; | ||
| ``` |
There was a problem hiding this comment.
Unsure about your choice to not include any other information except transaction_no and expense_area, as an output it's very uninformative. Especially as the key information will be amounts spent, suppliers, dates etc.
There was a problem hiding this comment.
My initial understating was that the requirements were transactions number and the expense area of 'Better Hospital Food'. Now the query shows all the other information needed from the tables.
Big-Spender/readme.md
Outdated
|
|
||
| ```sql | ||
| CREATE YOUR QUERY HERE | ||
| Select DATE_TRUNC('month', spends.date) AS month |
There was a problem hiding this comment.
You could approach this query with the mindset of "I am only going to give information that is informative to this request".
In this case, simply knowing the month alone is what the finance person is requesting.
So how could you turn the output of a timestamp rounded to a month into a column of just data identifying which month it is. No specific dates, no timestamps, just a month.
Big-Spender/readme.md
Outdated
|
|
||
| ```sql | ||
| INSERT YOUR QUERY HERE | ||
| Select description, SUM(amount) AS total_spent |
There was a problem hiding this comment.
We aren't looking for "description" here. In the database you can see a suppliers table which is joined to the spends table via the supplier_id.
How can you use this relationship to pull in the supplier name instead of the "description" of the charge?
There was a problem hiding this comment.
Description column replaced by amount column so the information need are accessible now.
Poonam-raj
left a comment
There was a problem hiding this comment.
Some strong psql queries being built here. A nice use of the built-in functions psql offers us to make our queries efficient. Particular love the final query to find ids for the expense type and area.
There are a few moments in the query where output isn't what we're looking for or the output could be refined so the information in the table is informative and usable for the user. Take a look at those queries and let me know how it goes when you rework them.
Learners, PR Template
Self checklist
Changelist
Added SQL queries to satisfy all defined user stories
Questions
Ask any questions you have for your reviewer.