1.4.11.3 In SQL

In SQL all strings must be properly quoted using single quotes. To insert a string like James into the database, we use the SQL 'James' but what if we want to insert the string tail's? Because it has a ' character in it we can't simply do 'tail's' as the SQL parser won't know which ' ends the string. Instead we use 'tail''s'. Double single quotes ('') in SQL mean a ' character.

The single quote character ' is the only character which needs special treatment in SQL all the others like \n behave exactly as they do in Python as described above.

For example:

cursor.execute("INSERT INTO table (columnOne) VALUES ('James''s')")