VALUES ( "myuser", "myuser@example.
com" );
Example return value:
Query OK, 1 row affected (0.06 sec)
The varchar a.k.a strings can be also be inserted using single quotes:
INSERT INTO mytable ( username, email )
VALUES ( 'username', '
[email protected]' );
Updating a row into a MySQL table
UPDATE mytable SET username="myuser" WHERE id=8
Example return value:
Query OK, 1 row affected (0.06 sec)
The int value can be inserted in a query without quotes. Strings and Dates must be enclosed in
single quote ' or double quotes ".
Deleting a row into a MySQL table
DELETE FROM mytable WHERE id=8
Example return value:
Query OK, 1 row affected (0.06 sec)
This will delete the row having id is 8.
Selecting rows based on conditions in MySQL
SELECT * FROM mytable WHERE username = "myuser";
Return value:
+----+----------+---------------------+
| id | username | email |
+----+----------+---------------------+
| 1 | myuser | [email protected] |
+----+----------+---------------------+
1 row in set (0.00 sec)
https://riptutorial.com/ 4