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

NW6 | Hadika Malik | Module-Database | Big-spender | Week 2 #167

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

HadikaMalik
Copy link

@HadikaMalik HadikaMalik commented May 25, 2024

Learners, PR Template

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with COHORT_NAME | FIRST_NAME LAST_NAME | REPO_NAME | WEEK
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

Briefly explain your PR.
I have completed the big-spender ticket.

Questions

Ask any questions you have for your reviewer.

Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Copy link

@sayoiscool sayoiscool left a comment

Choose a reason for hiding this comment

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

Great work overall! A little more work needed on the table insertions + attention to the minor details in requirements.

@@ -68,39 +68,48 @@ INSERT YOUR QUERY HERE
**You:** Then here's the query for that:

```sql
INSERT YOUR QUERY HERE
select * from spends where description ilike '%fee%';

Choose a reason for hiding this comment

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

Good work taking the capitlisations into consideration with 'ilike'

select s.*
from spends s
join expense_areas ea on s.expense_area_id = ea.id
where ea.expense_area ilike 'Better Hospital Food';

Choose a reason for hiding this comment

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

Good use of joins!

```

**Claire:** Great, that's very helpful. How about the total amount spent for each month?

**You:** You can get that by using the GROUP BY clause. Here's the query:

```sql
CREATE YOUR QUERY HERE
select to_char(date,'YYYY-MM') as month from spends group by month;

Choose a reason for hiding this comment

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

Good attempt and nice formatting of the date, however you have partially answered the question. Only one column is returned, but two are expected in your results. Which column is missing?

```

**Farnoosh:** Oh, how do I know who these suppliers are? There's only numbers here.

**You:** Whoops! I gave you ids to key the totals, but let me give you names instead.

```sql
INSERT YOUR QUERY HERE
select sp.amount, sup.supplier

Choose a reason for hiding this comment

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

The question is for the total amount spent by each supplier. Which operator missing here is needed to get the desired result?

'3780119655',
'Computer Hardware Dell',
32000
);
Copy link

@sayoiscool sayoiscool Jun 15, 2024

Choose a reason for hiding this comment

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

Good attempt here. The rows ' Dell', 'Hardware' and 'IT' are missing from other tables, what extra step is needed to have the rows populated where necessary? What effect will this change have on the 'id's inserted in spends table?

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