Suppose I have a table :
Table A:
Id Name Movie Comment
1 Foo Bar anything
2 Foo Bar anything
Here I want to make sure that the user cannot insert Foo and Bar twice , but he is allowed to insert Foo , foobar .
One solution to prevent this duplication was to add this statement ALTER TABLE table ADD UNIQUE KEY(Name , Movie). That was probably for sql not sqlite. I wrote the same command in python for sqlite3 as cur.execute("ALTER TABLE ADD UNIQUE KEY(Name,Movie)"). It gave me the error sqlite3.operationalerror: near "unique" syntax error. Is there anything that can be done while creating the table A , or is there any mistake in my sqlite query .
Help is appreciated .