Consider the table marks:
mysql> SELECT * FROM marks;
+--------+------------+-----------------------+
| name | percentage | email |
+--------+------------+-----------------------+
| Bipin | 84% | [email protected] |
| Deepak | 78% | [email protected] |
| Rohith | 82% | [email protected] |
| Sujit | 94% | [email protected] |
+--------+------------+-----------------------+
When I made the following query to insert values to the table, it resulted in an error:
mysql> INSERT INTO marks VALUES('&name','&percentage','&email');
ERROR 1406 (22001): Data too long for column 'percentage' at row 1
It was done as an experiment based on info about another way to insert value using ('&') in SQL.
Can you specify what went wrong? According to the blog, simply pressing ENTER will insert values after the query.
The desired output:
Enter value for name: John
Enter value for percentage: 76%
Enter value for email: [email protected]
&percentageinto the table. - Barmar