Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8816969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:44:25+00:00 2026-06-14T04:44:25+00:00

okay so i have one database with three columns: id, username, and rating. The

  • 0

okay so i have one database with three columns: id, username, and rating.

The database would look like this:

 ------------ ------------ ------------ 
|     ID     |     NAME   |   RATING   |
 ------------ ------------ ------------
|     1      |   bc112    |      3     |
 ------------ ------------ ------------
|     2      |   cd111    |      1     |
 ------------ ------------ ------------
|     2      |   cd111    |      2     |
 ------------ ------------ ------------
|     2      |   cd111    |      6     |
 ------------ ------------ ------------

So basically where I am stuck is how do I get the average rating for each specific user?

I tried this:

SELECT ID, RATING
FROM THING
WHERE AVG(RATING) FOR ID < 3;

But the result is showing me nothing. What is wrong with the code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T04:44:26+00:00Added an answer on June 14, 2026 at 4:44 am

    By using AVG aggregate function, group by clause and having clause as follows:

    SQL> with t1 (ID, NAME, RATING) as
      2  (
      3    select 1, 'bc112', 3  from dual union all
      4    select 2, 'cd111', 1  from dual union all
      5    select 2, 'cd111', 2  from dual union all
      6    select 2, 'cd111', 6  from dual
      7  )
      8  select ID
      9       , NAME
     10       , avg(rating)
     11    from t1
     12   group by id, name
     13   having avg(rating) > 2 
     14  ;
    
            ID NAME  AVG(RATING)
    ---------- ----- -----------
             1 bc112           3
             2 cd111           3
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, so let's say I have a mysql database table with two columns, one
Okay, I am stumped with this one. I have a table in my database
Okay, Now admittedly this sounds like a silly question; But, I actually have a
Okay, we have a database, with a not-so-good tables-columns layout, for a small news
Let's say I have a database column 'grade' like this: |grade| | 1| |
I have a database and this includes three tables as follows: -Player -Player Previous
Okay, on one of my sites I have a news sidebar that displays events
okay i have been trying to understand this for hours i am learning VB
Okay this may sound a bit weird but it is what I have to
Okay guys I have a database I have been working on for days now.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.