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.
JavaScript
x
7
1
exists = cursor.execute("SELECT TOP 1 * FROM Employees WHERE ID = ?", (str(input),))
2
print(exists)
3
if exists is None:
4
return False
5
else:
6
return True
7
Advertisement
Answer
I think this is what you are looking for:
JavaScript
1
4
1
insert_query = '''SELECT TOP 1 * FROM EmployeeTable WHERE ID = (?);''' # '?' is a placeholder
2
cursor.execute(insert_query, str(input))
3
4