BIGQUERY equivalents of sign(bitand...) function - google-bigquery

I need to decode one column on Big Query. In Oracle SQL Developer I used
sign(bitand(column, power(2,18)))
Can I use its equivalent on Big Query?

Below is for BigQuery Standard SQL
You can use
SIGN(column & CAST(POWER(2,18) AS INT64))

Related

starts_with in presto?

I am new to writing sql queries in presto and was looking for a function similar to 'starts_with'.
If a string starts with a given substring then the query needs to return that record.
In Postgresql, I am currently doing select * from tableA where name~'^Joh'. Whats the equivalent of this in Presto?
PostgreSQL and presto are RDBMS based on SQL. It is weird to see that you've learned a PostgreSQL proprietary add on (regular expressions) to the language before learning the standard SQL functions. In SQL you use LIKE for pattern matches:
select * from tableA where name like 'Joh%';
You can use Like in SQL. You can go through this link https://www.w3schools.com/sql/sql_like.asp. Using like you can search for a specified pattern.
In presto you can use regexp_like() which runs little faster than other like operators.For your case try below query which should provide you with expected functionality.
select regexp_like('John', '^John')

Vertica's LISTAGG() Big Query Equivalent

While migrating Vertica run reports to BQ, I stumbled upon a Vertica pre-built function LISTAGG().
What is the equivalent on Big Query?
Replace with this
Vertica:
LISTAGG(column,'delimiter')
Big Query:
STRING_AGG(column,'delimiter')
Make sure to CAST(column as STRING) in case Vertica's column is from INT

BigQuery standard sql - not match regex

I'm trying to create a query that will select everything
that is not matching a given regex
In legacy, we had REGEX_MATCH so I was able to do
WHERE x NOT REGEX_MATCH("[a-z]")
What would be the equivalent on standard SQL?
In BigQuery Standrad SQL you should use REGEXP_CONTAINS(value, regex) instead
For example
WHERE NOT REGEXP_CONTAINS(x, r'[a-z]')

How to create real function in Bigquery Legacy SQL

I know UDF in legacy sql, but UDF need you pass whole row into function, and return whole record, and UDF can't put into select section, this is not real function I need, Is Bigquery Legacy SQL can write function like Standard SQL? (can put into select or where section)
thanks :)
This functionality is only supported in Standard SQL (and as Elliott mentions in the comments, is unlikely to be added to Legacy SQL because it is being phased out).

Table ranges with BigQuery's standard SQL

How can you query a range of timestamped tables with the new syntax? Using TABLE_DATE_RANGE returns the error Unhandled node type in from clause: TVF.
The latest version of BigQuery supports an equivalent of table wildcards with Standard SQL. The documentation is available here: https://cloud.google.com/bigquery/docs/wildcard-tables.
Also please take a look at this post:
Is there an equivalent of table wildcard functions in BigQuery with standard SQL?