Example of a column:
This is what I have tried. I only want to search based on a single column in the table. Lets says the table name is Employees
. The input
parameter is entered by the user in console.
exists = cursor.execute("SELECT TOP 1 * FROM Employees WHERE ID = ?", (str(input),)) print(exists) if exists is None: return False else: return True
Advertisement
Answer
I think this is what you are looking for:
insert_query = '''SELECT TOP 1 * FROM EmployeeTable WHERE ID = (?);''' # '?' is a placeholder cursor.execute(insert_query, str(input))