You just need to update your SQLite to the latest version and this query will work.
If you are working on Colab then the default SQLite version is old. And older versions throws up OperationalError whenever there are compound queries which require special characters like ( , * etc.
I have referred to this answer to update SQLite to the latest version on Colab:
https://stackoverflow.com/a/59429952/13248955
Here's the code snippet:
# compiling is the same as before
!curl https://www.sqlite.org/src/tarball/sqlite.tar.gz?r=release | tar xz
%cd sqlite/
!./configure
!make sqlite3.c
%cd /content
!npx degit coleifer/pysqlite3 -f
!cp sqlite/sqlite3.[ch] .
!python setup.py build_static build
will unzip the sqlite latest version
# check where it is now
!ls build
lib.linux-x86_64-3.7 temp.linux-x86_64-3.7
# !ls build/lib.linux-*version which you got as output in previous step*/pysqlite3/
!ls build/lib.linux-x86_64-3.7/pysqlite3/
dbapi2.py init.py _sqlite3.cpython-37m-x86_64-linux-gnu.so
!ls /usr/lib/ | grep python
The output will be something like this:
python2.7 python3 python3.6 python3.7 python3.8
# From the list, select python3.7
!cp build/lib.linux-x86_64-3.7/pysqlite3/_sqlite3.cpython-37m-x86_64-linux-gnu.so/usr/lib/python3.7/lib-dynload/
then MENU: Runtime > Restart runtime
import sqlite3
sqlite3.sqlite_version
'3.37.2' // will print out the latest SQLite version