Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to utilize Count function in Oracle Developer
    primarykey
    data
    text
    <p>Ok so I'm working on my homework and am having trouble getting the Count function to work correctly. </p> <p>I am supposed to use "A query that lists all teams that have more than 4 players (in the players table). Include the columns team_id, team_name, and the count of players for that team."</p> <p>It is just a simple NHL database our teacher made up for this assignment. There are 18 teams in the teams database and 74 players in the players database.</p> <p>This is what I have written as of right now:</p> <pre><code>SELECT teams.team_id, teams.team_name, COUNT(players.team_id) AS PlayerCount FROM teams, players GROUP BY teams.team_id, teams.team_name HAVING COUNT(players.team_id) &gt; 4; </code></pre> <p>And when I run that this is the output I get:</p> <pre><code>TEAM_ID TEAM_NAME PLAYERCOUNT ------- ----------------------------------- ---------------------- TBL Tampa Bay Lightening 74 BOS Bostong Bruins 74 SJS San Jose Sharks 74 NYI New York Islanders 74 MIN Minnesota Wild 74 DET Detroit Red Wings 74 NYR New York Rangers 74 PHL Philadelphia Flyers 74 BUF Buffalo Bruins 74 PIT Pittsburgh Penguins 74 DAL Dallas Stars 74 VAN Vancouver Canucks 74 WSH Washington Capitals 74 COL Colorado Avalanche 74 TOR Toronto Maple Leafs 74 CLB Columbus Blue Jackets 74 CHI Chicago Blackhawks 74 ATL Atlanta Thrashers 74 18 rows selected </code></pre> <p>I know it's probably pretty simple to fix, but I can't find anything that's like that in my textbook and the Google results I get are either not the same thing or more sophisticated than what I am trying to do.</p> <p>Any help is greatly appreciated.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload