Sponsered Links
Categories
Sponsered Links

MySQL INSERT Query Example for inserting single quotes

 

This is a simple MySQL INSERT Query Example for inserting single quotes in the database table.

mysql> INSERT INTO Employee (name) value ("Rakesh'Kumar'Ranjan");
Query OK, 1 row affected (0.01 sec)

mysql> select * from Employee;
+------+---------------------+--------------------+--------------+-----------+
| id   | name                | designation        | salary_in_Rs | city      |
+------+---------------------+--------------------+--------------+-----------+
|    6 | Anusmita            | Software Developer |     45000.00 | Bareilly  |
|    1 | Ravi Kant           | Team Leader        |     55000.00 | Kanpur    |
|    2 | Sachin Kumar        | Software Engineer  |     42000.00 | Gorakhpur |
|    3 | Sandeep Kumar Suman | Software Developer |     42000.00 | Gorakhpur |
|    5 | Avnish Kumar        | Programmer         |     21000.00 | Barabanki |
|    4 | Varun "Kumar" Rai   | programmer         |     25000.00 | Gorakhpur |
| NULL | Rakesh'Kumar'Ranjan | NULL               |         NULL | NULL      |
+------+---------------------+--------------------+--------------+-----------+
7 rows in set (0.00 sec)

mysql> INSERT INTO Employee (id, name, designation, salary_in_Rs, city) value (7, "Rakesh'Kumar'Ranjan", 'Publ
ic Relationship Officer', 17000.00, 'Gorakhpur');
ERROR 1406 (22001): Data too long for column 'designation' at row 1
mysql> INSERT INTO Employee (id, name, designation, salary_in_Rs, city) value (7, "Rakesh'Kumar'Ranjan", 'PRO'
, 17000.00, 'Gorakhpur');
Query OK, 1 row affected (0.02 sec)

mysql> select * from Employee;
+------+---------------------+--------------------+--------------+-----------+
| id   | name                | designation        | salary_in_Rs | city      |
+------+---------------------+--------------------+--------------+-----------+
|    6 | Anusmita            | Software Developer |     45000.00 | Bareilly  |
|    1 | Ravi Kant           | Team Leader        |     55000.00 | Kanpur    |
|    2 | Sachin Kumar        | Software Engineer  |     42000.00 | Gorakhpur |
|    3 | Sandeep Kumar Suman | Software Developer |     42000.00 | Gorakhpur |
|    5 | Avnish Kumar        | Programmer         |     21000.00 | Barabanki |
|    4 | Varun "Kumar" Rai   | programmer         |     25000.00 | Gorakhpur |
| NULL | Rakesh'Kumar'Ranjan | NULL               |         NULL | NULL      |
|    7 | Rakesh'Kumar'Ranjan | PRO                |     17000.00 | Gorakhpur |
+------+---------------------+--------------------+--------------+-----------+
8 rows in set (0.00 sec)

mysql>

 
 
Sponsered Links
Latest Updates
 
All Content of this site is for learning only. We do not warrant the correctness of its content. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright © 2009 JSPSERVLETTUTORIAL.INFO All Right Reserved