NW6 | Sabella Fisseha | Module-DataBases | Big_Spender | week 2#159
NW6 | Sabella Fisseha | Module-DataBases | Big_Spender | week 2#159Sabella-8 wants to merge 1 commit intoCodeYourFuture:mainfrom
Conversation
|
sayoiscool
left a comment
There was a problem hiding this comment.
Great work overall! Good attention to detail with the table insertions and good understanding of some postgresql operators. However a few more query revisions needed, as described in comments.
| ``` | ||
|
|
||
| ```` | ||
| select * from spends where description ilike '%FeE%' |
There was a problem hiding this comment.
Good work taking capitalisations into consideration with 'ilike'. note you don't have to mix cases in the word, e.g '%FeE%' can simply be written as '%fee%'. ILIKE already handles the case insensitive matching
|
|
||
| SELECT spends.*, expense_areas.expense_area | ||
| FROM spends | ||
| INNER JOIN expense_areas ON expense_areas.id = spends.expense_area_id |
| ```sql | ||
| CREATE YOUR QUERY HERE | ||
|
|
||
| SELECT DATE_TRUNC('month', date)::date AS month, SUM(amount) AS total |
|
|
||
| SELECT SUM(spends.amount) AS total_amount | ||
| FROM spends | ||
| INNER JOIN suppliers ON suppliers.id = spends.supplier_id |
There was a problem hiding this comment.
Great job with the joins! However, two columns are expected in the results. What additional information from the suppliers table should be included in the SELECT statement?
|
|
||
| SELECT date, SUM(amount) AS total_amount | ||
| FROM spends | ||
| WHERE date BETWEEN '2021-03-01' AND '2021-04-01' |
There was a problem hiding this comment.
Good attempt. Note that total amounts for only those two dates are required, and not every date inbetween. Which operator will allow for multiple distinct values to be specified in your WHERE statement?
| insert into expense_types (expense_type) values ('Hardware'); | ||
| select id from expense_areas where expense_area = 'IT'; | ||
| insert into expense_areas (expense_area) values ('IT'); | ||
|
|
There was a problem hiding this comment.
Great attention to detail! The 'Hardware', 'Dell', and 'IT' rows were missing from the other tables, and you've done well by adding the necessary insert statements to populate them.




Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
Questions
Ask any questions you have for your reviewer.