课程: Intermediate SQL for Data Scientists

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Reformatting numeric data

Reformatting numeric data

- [Instructor] Now sometimes we need to reformat numeric data. So let's take a look at salaries again. So we're going to work with select and let's select salary from the data_sci.employees table. And actually what we want to do is let's work with the average salary 'cause we want to see different ways that we can work with values that have a fairly large number of digits in the decimal places. So for example here, we have the average salary of around $97,433 and 54 to 55 cents, but there's a lot of digits in this calculation, which is really helpful. It's great that we can use Postgres to do some fairly high precision calculations like this, but really oftentimes we don't need to have that level of precision. And we have seen in previous videos how we can use the round operation to round this value. So this should round up to 97,434 if I read this correctly and it does. So we can use the round operation. And remember, we can also specify a number of digits we want to round to. So for…

内容