アルサ
アルサ

Reputation: 53

How to find rows that start with number or alphabet in Bigquery?

I have a table with more than 1000000 rows, I want to download it to a csv(google drive) but for some reason I can't even the size is less than 1GB.

Now I want to divide it to two file, there is no id column, just a column that is a mix of numbers and alphabets. So I thought maybe DL the rows that start with number and next rows that start with alphabets can be a good idea.

The following code for choosing the rows start with numbers returns no data. Please help

select *
from MyTable
where uid like '^[0-9]%'
--where uid regex '^[0-9]%'

Upvotes: 1

Views: 2508

Answers (1)

Tim Biegeleisen
Tim Biegeleisen

Reputation: 522817

We can use REGEXP_CONTAINS here:

SELECT *
FROM MyTable
WHERE REGEXP_CONTAINS(uid, r'^[A-Za-z0-9]');

Upvotes: 4

Related Questions