Skip to content

Session #20 HW#34

Open
FCBernstein wants to merge 3 commits into
CPU-Code-School:mainfrom
FCBernstein:main
Open

Session #20 HW#34
FCBernstein wants to merge 3 commits into
CPU-Code-School:mainfrom
FCBernstein:main

Conversation

@FCBernstein
Copy link
Copy Markdown

Please review/Comment. Thank you

Comment thread 1 Table.sql Outdated
Comment thread 2 Data.sql Outdated
Comment thread 3 Reports.sql Outdated
Group by p.PetType

--2)we need to see how many customers have multiple pets.
SELECT NumOfCustomers = Count(*) from (
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This can be done simply with a group by and having, no need for a subquery.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

When I do a simple group by/having, I get a list of the costumers who have more than 1 pet, which, to be honest, is more useful information, but the biz-scenario asks for "how many customers have multiple pets" not a "list of customers that have multiple pets". Am I missing something? Is there a way to get the count of customers who have multiple pets without a subquery?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The question was asking that, show a list of customers that have multiple pets, sorry it wasn't so clear. Please fix

Copy link
Copy Markdown
Contributor

@AvigailGellis AvigailGellis left a comment

Choose a reason for hiding this comment

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

AS: Great job! 95% Please see minor comments and resubmit.

Copy link
Copy Markdown
Author

@FCBernstein FCBernstein left a comment

Choose a reason for hiding this comment

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

I think I made all the necessary corrections, but please see my comment by the reports and explain, if possible.
Thank you

Comment thread 1 Table.sql Outdated
Comment thread 2 Data.sql Outdated
Comment thread 3 Reports.sql Outdated
Group by p.PetType

--2)we need to see how many customers have multiple pets.
SELECT NumOfCustomers = Count(*) from (
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

When I do a simple group by/having, I get a list of the costumers who have more than 1 pet, which, to be honest, is more useful information, but the biz-scenario asks for "how many customers have multiple pets" not a "list of customers that have multiple pets". Am I missing something? Is there a way to get the count of customers who have multiple pets without a subquery?

@FCBernstein
Copy link
Copy Markdown
Author

I fixed the report.
Thank you

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