Cannot Run SQL INSERT in MySQL Neither

[vagrant@localhost ~]$ sudo mysql -e "USE books; INSERT INTO authors (id,name,email) VALUES(1,"test","test@gmail.com");"
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@gmail.com)' at line 1


Nor

[vagrant@localhost ~]$ sudo mysql -e "USE books; INSERT INTO authors (id,name,email) VALUES(1,"test","gmail.com");"
ERROR 1054 (42S22) at line 1: Unknown column 'test' in 'field list'


works for inserting values in MySQL, while the columns exist:

[vagrant@localhost ~]$ sudo mysql -e "USE books; SHOW COLUMNS FROM authors;"
+-------+-------------+------+-----+---------+-------+
| Field | Type        | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| id    | int(11)     | YES  |     | NULL    |       |
| name  | varchar(20) | YES  |     | NULL    |       |
| email | varchar(20) | YES  |     | NULL    |       |
+-------+-------------+------+-----+---------+-------+


Version

[vagrant@localhost ~]$ mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.1.73 Source distribution
You are using the wrong quotes for the SQL

SUGGESTION #1 : Use Single Quotes for the SQL

sudo mysql -e "USE books; INSERT INTO authors (id,name,email) VALUES(1,'test','gmail.com');"


SUGGESTION #2 : Escape Double Quotes for SQL with Backslash (\)

sudo mysql -e "USE books; INSERT INTO authors (id,name,email) VALUES(1,\"test\",\"gmail.com\");"


The confusion is caused by the double quotes you are using for the sudo and for the SQL

GIVE IT A TRY !!!