Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialRobert Ott
Courses Plus Student 4,614 PointsCode Challenge #1 - numeric formatting
When I run the correct query for Code Challenge 1 the numbers are formatted as follows:
average 0.28372E1 0.30732E1 0.38333E1 0.27E1 0.36154E1 0.15E1 0.29167E1
When I run the same query with the Workbench the numbers are formatted as follows:
'2.8372' '3.0732' '3.8333' '2.7000' '3.6154' '1.5000' '2.9167'
What accounts for the difference and what can I add to the exercise SQL statement to format the results?
Thanks
2 Answers
Tod Novak
3,173 PointsI get the same thing. I believe it's because the Treehouse workspace is using a higher precision than what MySQL Workbench is using. The 'E' in the workspace results is scientific notation, which is used to replace numbers that are too large to display.
I don't know if there's any way to change that, either in workspaces or Workbench as a default, but you can express the precision as part of the query when declaring variables.
Robert Ott
Courses Plus Student 4,614 PointsThanks Tod. I'll check out the precision options for queries.