String contains a quote '

From SQLZoo
Jump to navigation Jump to search

String contains a quote '

schema:scott

If the data contains a single quote it must be escaped.

DELETE FROM t_q
DROP TABLE t_q;
CREATE TABLE t_q (a VARCHAR(8));
INSERT INTO t_q VALUES ('O''Brian');
SELECT * FROM t_q
DataWars, Data Science Practice Projects - LogoDataWars: Practice Data Science/Analysis with +100 Real Life Projects