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

Time:12-14

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]%'

CodePudding user response:

We can use REGEXP_CONTAINS here:

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