The SIGN function


Use SIGN to see if a number is positive, negative, or zero.

It's as simple as it sounds.

Apply SIGN() to an integer or float column to get:
- SIGN(0) gives 0

Caution! Be careful of near-zero floats that are not actually zero.

For example, SIGN(0.0000001) will return 1 since it is a positive number.

This can happen when you have round-off errors when storing FLOATS in a database. For example, 3.0 might be stored as 2.9999999...

πŸ‘‡ The SIGN() function can be implemented with a CASE WHEN. See example 2 below.

More from Travis Tang
Use ARRAY_AGG to flatten columns to lists.

Use ARRAY_AGG to flatten columns to lists.

You need to convert a long table of values into a list? This is the most convenient function. πŸ“Œ Syntax: πš‚π™΄π™»π™΄π™²πšƒ π™°πšπšπ™°πšˆ_𝙰𝙢𝙢(πšŒπš˜πš•πšžπš–πš—) π™΅πšπ™Ύπ™Ό πšπšŠπš‹πš•πšŽ There
Pivot Table (From Long to Wide)

Pivot Table (From Long to Wide)

Every data scientist, scientist, and engineer should know how to create a pivot table. π™²π™°πš‚π™΄ πš†π™·π™΄π™½ is the best way to do
Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to Travis Tang.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.