Để chèn chuỗi có dấu nháy đơn (ví dụ: You've), bọc chuỗi trong nháy kép "You've" hoặc escape dấu nháy đơn 'You''ve'.
Tạo bảng:
mysql> CREATE TABLE DemoTable (Note TEXT); Query OK, 0 rows affected (0.57 sec)
Chèn dữ liệu (dùng nháy kép bao quanh):
mysql> INSERT INTO DemoTable VALUES("You've seen the Taj? When?"); Query OK, 1 row affected (0.09 sec)
mysql> INSERT INTO DemoTable VALUES("You've visited the US?"); Query OK, 1 row affected (0.16 sec)
Hiển thị dữ liệu (dấu nháy đơn hiển thị đúng):
mysql> SELECT * FROM DemoTable;
Kết quả:
+---------------------------------+ | Note | +---------------------------------+ | You've seen the Taj? When? | | You've visited the US? | +---------------------------------+ 2 rows in set (0.00 sec)
Cách khác: Dùng escape 'You''ve' (hai dấu nháy đơn = một dấu nháy đơn trong chuỗi).