Im pretty new to sql, so bear with me..
I have a database with 22 tables, all connected with a primarykey (product number)
I need to get all columns from all tables that match one primary key.
Today i use a query ala this:
query = """ select * from pt_MatText where artikkelnummer = ?"""
cursor.execute(query,artNR)
pt_MatText = cursor.fetchall()
pt_MatText = list(pt_MatText[0]) #makes a list of the returned tuple
pt_MatText.pop(0) #Removes the primary key, so that im left with only the columns i want
I do this the same way for every table i have (22) It seems a bit slow, so is it possible to improve the way i get the data from my tables to improve speed? Or the general quality? Also, ive heard that using cursors is to be avoided. Why is this?