Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

151
Views
Return table from Snowflake Javascript UDF for the following SQL UDF. What should be the code modification?

Following is the sql udf which need to be converted to javascript udf with same tabular output.

    CREATE OR REPLACE FUNCTION "TEST_UDF"()
    RETURNS TABLE ("TOTAL_CUSTOMERS" NUMBER(38,0), "COUNTRIES" NUMBER(38,0), "US_STATES" NUMBER(38,0), "CITIES" NUMBER(38,0), "MIN_AGE" VARCHAR(16777216), "MAX_AGE" VARCHAR(16777216), "WOMEN" NUMBER(38,0), "MEN" NUMBER(38,0), "OTHER" NUMBER(38,0))
    LANGUAGE SQL
    AS $$
        select 
        COUNT(DISTINCT(HUX_ID)) AS TOTAL_CUSTOMERS,
        COUNT(DISTINCT(COUNTRY)) AS COUNTRIES,
        COUNT(DISTINCT(STATE)) AS US_STATES,
        COUNT(DISTINCT(CITY)) AS CITIES,
        MIN(AGE) AS MIN_AGE,
        MAX(AGE) AS MAX_AGE,
        ROUND(COUNT(CASE WHEN GENDER = 'F' THEN 1 END)* 100 / COUNT(GENDER),8) AS WOMEN,
        ROUND(COUNT(CASE WHEN GENDER = 'M' THEN 1 END)* 100 / COUNT(GENDER),8) AS MEN,
        ROUND(COUNT(CASE WHEN GENDER = 'U' THEN 1 END)* 100 / COUNT(GENDER),8) AS OTHER
        from DETAIL_CUSTOMER
        
                 order by total_CUSTOMERS desc
                 
        $$;
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!