SunnyX
asked on
mySQL. SQL query. Substitute for Numeric key word.
Let say I need to solve the problem :
With a precision of two decimal places, determine the average number of guns for the battleship classes.
The query about work fine but show me result with more than 2 decimal points.
I need to write sql query that will be analog query below but will be work on mySQL server ( as far as I understand Numeric key word didn't work in mySQL server )
So how can I rewrite the query above in order that it'll work in mySQL server.
Thx in advance !
With a precision of two decimal places, determine the average number of guns for the battleship classes.
SELECT AVG(numGuns+0.0)
FROM Classes
WHERE type = 'bb'
The query about work fine but show me result with more than 2 decimal points.
I need to write sql query that will be analog query below but will be work on mySQL server ( as far as I understand Numeric key word didn't work in mySQL server )
SELECT CAST ( AVG(numGuns+0.0) AS NUMERIC(10,2) )
FROM Classes
WHERE type = 'bb'
So how can I rewrite the query above in order that it'll work in mySQL server.
Thx in advance !
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER