Home > database >  SQL novice, basic question someone help me to look at me, thank you
SQL novice, basic question someone help me to look at me, thank you

Time:10-04

CodePudding user response:

Pictures are not complete

CodePudding user response:

reference 1st floor sxq129601 response:
pictures haven't take complete

, table 1 and table 2 has given, for the first topic is to show the class name and the student's name, the second part shows the class name and total number of students, the third problem is to make the total number of classes and students for more than 30 people,

CodePudding user response:

1 remove the group by, left the join to the inner join
The second question:
Select class. Id, Max (class name), count (*) from... Group by class. Id
The third topic: write their own group by + having the count (*) & gt; 30

CodePudding user response:

The
reference 3 floor sxq129601 response:
1 remove group by, left the join to the inner join
The second question:
Select class. Id, Max (class name), count (*) from... Group by class. Id
The third topic: write their own group by + having the count (*) & gt; 30

Thank you for

CodePudding user response:

The
reference 3 floor sxq129601 response:
1 remove group by, left the join to the inner join
The second question:
Select class. Id, Max (class name), count (*) from... Group by class. Id
The third topic: write their own group by + having the count (*) & gt; 30

I have a few questions, first question: the second question, did not need my query CLASS. The ID, neither have used MAX () function,
Second question if you use the COUNT (*), if the list is empty list NULL, so children should be able to change the value of the total number of large,
The third question. Why can't use the CLASS NAME to group,
If think I where said is wrong, please point out, thank you are willing to spend time answering questions for me

CodePudding user response:

Wrong rows are empty, not empty list

CodePudding user response:

First, then you have good id removed, Max is must or complains, because the name is not grouping items
Second, statistical number can only use the count, sum sum mean, 1, 2, and 3 sum over three people turned 6 not
Third, had better use ID group, because ID is unique, the NAME may occur if people sharing the same NAME


CodePudding user response:

refer to 7th floor sxq129601 response:
first, that you have good id removed, Max is must or complains, because the name is not grouping items
Second, statistical number can only use the count, sum sum mean, 1, 2, and 3 sum over three people turned 6 not
Third, had better use ID group, because ID is unique, the NAME may occur if people sharing the same NAME

Thanks, I see the , or I think less
  • Related