To add a record use the INSERT statement:
One can also add multiple records stored in advance in a file with the following syntax:
Use one line per record and separate the records by the TABs. If a field in a record is missing, use the keyword NULL instead.
This feature is, however, not supported by the MySQL version installed on the server.
The easiest way to display all records in a small database it to use the following syntax:
mysql> SELECT * FROM products; +--------------+----------+--------+----------+ | make | model | price | quantity | +--------------+----------+--------+----------+ | AMD | Athlon | 250.99 | 21 | | Intel | Pentium | 399.95 | 25 | | Linksys | WRT54GL | 69.99 | 14 | | D-Link | DI-524 | 40.99 | 12 | | NETGEAR | WGT624 | 64.99 | 15 | | MOTOROLA | SB5120 | 59.99 | 8 | | U.S.Robotics | USR5686E | 80.99 | 5 | | ZALMAN | VF900 | 49.99 | 10 | | Thermaltake | A1280 | 8.49 | 16 | +--------------+----------+--------+----------+ 9 rows in set (0.00 sec)
Use the SELECT command to sort the values in ascending or descending order:
In the above example, the entries will be sorted first my make and secondary by model (for the same make, if any).
One can specify the records to retrieve by using the WHERE keyword:
To update an existing record, use the UPDATE statement:
To delete a record, use the following syntax: