I am running SQL queries in Python using Pandasql. The queries x, y and z work fine but u gives an error
x = pysql("select * from flight f left join iata i on f.ORIGIN = i.IATA;")
y = pysql("select * from flight f inner join iata i on f.ORIGIN = i.IATA;")
z = pysql("select * from flight, iata where flight.ORIGIN = iata.IATA;")
u = pysql("select * from flight f, iata i where f.ORIGIN = i.IATA;")
The error message is
PandaSQLException: (sqlite3.OperationalError) no such table: iata [SQL: 'select * from flight f, iata i where f.ORIGIN = i.IATA;']
Question : What is wrong with u? It looks like we can use aliases in a join without mentioning left, right, inner etc. Is this true?
Because you must explicitly alias it with AS when using old style joins
instead
select * from flight f, iata i where f.ORIGIN = i.IATA;
write
select * from flight AS f, iata AS i where f.ORIGIN = i.IATA;
试试这个代码
u = pysql("SELECT * from flight f join iata i on (f.ORIGIN = i.IATA);")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.