Catalina
Catalina

Reputation: 101

"Missing closing parenthesis" MySQL error

I am trying to run a query that will show the rounded average to two decimal places. This is my code and I don't know why I keep getting the error.

SELECT 
    ROUND(AVG (Scholarship, 2)) AS 'Average Scholarships'
FROM
    student;

Upvotes: 0

Views: 671

Answers (2)

James Monger
James Monger

Reputation: 10665

You are passing Scholarship, 2 to the AVG function, which only expects one argument.

What you meant to do was pass AVG (Scholarship) and 2 to ROUND, like this:

SELECT ROUND(AVG (Scholarship), 2) AS 'Average Scholarships' FROM student;

Upvotes: 3

Randy
Randy

Reputation: 16677

SELECT ROUND(AVG (Scholarship), 2) AS 'Average Scholarships' FROM student;

Upvotes: 1

Related Questions