0

Im currently using python mysql and cannot find relevant information online (ive been looking for around an hour) maybe i am miss-searching correct terms to find this relivant information.

while inputting data within a table it requires % values, i am using the following to insert strings:

query = "INSERT INTO OWNERINFO(`Name`) VALUES( %s )

i assume %s identifies strings, i am wondering how you identify other data types ie. int, tinyint, smallint, date, etc.

or if there is a specific web-page which shows thse data types which i have missed?

2 Answers 2

1

%s is placeholder, it can be used for integer, float also..

https://pynative.com/python-mysql-insert-data-into-database-table/

Sign up to request clarification or add additional context in comments.

Comments

0

The following should do the job:

values_to_enter = ("value1", "value2")
query = "insert into <table_name> values (%s, %s)"
mycursor.execute(query, values_to_enter)

Comments