As I know, the SELECT syntax is used for getting data from a row instead of column, here I have a column called time in a table, and I just want to select all the data in this time column, put them in an array, and use this array later.
So how can I select a column of data and put them into an array?
Michael J. Barber
25.2k9 gold badges71 silver badges92 bronze badges
asked Nov 24, 2011 at 10:02
manxing
3,33512 gold badges49 silver badges57 bronze badges
1 Answer 1
The query: SELECT time FROM Table
Use this query to populate an array in python!
db = MySQLdb.connect(user="yourUser",passwd="1337",db="awesomeDB")
cursor = db.cursor()
resultSet = "SELECT time FROM tableX"
cursor.execute(resultSet)
for row in cursor
#do something here, maybe add to an array if you want
arrayList.append(row)
Something like this?
answered Nov 24, 2011 at 10:06
Phil
3,99212 gold badges42 silver badges64 bronze badges
Sign up to request clarification or add additional context in comments.
1 Comment
Phil
me too. If it was helpful, please upvote and mark as answer as it gives incentive to users to answer questions :)
default