skip to Main Content

I am trying to multiply the existing value with some constant value o.1876. the output of the data is looks like

sales_agg

  • 0.01314717
  • 1.46E-04
  • 0.00236974
  • 0.02031013
  • 0.01421709
  • 0.25651208
  • 0.10146865
  • 0.00435217
  • 0.01827912
  • 0.12998486

i just need to mutiply the constant values to existing data and bring to a another column in sql query. tried with Cast Int but no luck. i can ignore the non numeric data in the list and multiply only with proper numeric data.

2

Answers


  1. In AWS Athena SQL, multiplying a constant number with existing data can be achieved using a straightforward query. For example, to multiply a column by a constant, use:

    SELECT column_name * constant_value AS new_column FROM table_name;
    

    This operation scales the data, allowing for various analytical tasks and insights.

    Login or Signup to reply.
  2. Think of the values in a SELECT as being a formula. You can therefore use:

    select
      sales_agg * .1876,
      other_column
    from table_name
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search