When I am trying to run below code in google colab:
#Get required Data
data8 = pd.read_sql_query('''SELECT Person.Name, Person.Gender
FROM M_Cast left JOIN Person USING (PID)
WHERE PID NOT IN
(
SELECT DISTINCT(PID) as PID
FROM
(
SELECT *, LEAD(M_year, 1, 0) OVER (PARTITION BY Actor ORDER BY M_year ASC) AS N_Year
FROM
(
SELECT trim(person.PID) as PID, trim(Person.Name) as Actor, substr(Movie.year,length(Movie.year)-3,4) as M_Year
FROM Person
LEFT JOIN M_Cast USING (PID)
LEFT JOIN Movie USING (MID)
)
)
WHERE (N_Year-M_Year)>3
)''',con)
print('Output 8: Following is the list of actors never unemployed more than 3 years.(Included actors having single movie):\n')
data8
Colab throws me an error DatabaseError: Execution failed on sql : near "(": syntax error
while its running well on my jupyter notebook