3.8. Exercises

  1. Connect to a database which has the same name as your login (for instance, train01) by typing mysql -p train01 (the -p flag causes it to ask you for your password, which in this case is the same as your login password). The database you are connecting to is your own personal copy of the Acme Widget Co. inventory and sales database mentioned in the previous section

  2. Type show tables to show a list of tables in this database

  3. Type describe customer to see a description of the fields in the table customer

  4. Type select * from customer to perform a simple SQL query

  5. Try selecting fields from other tables. Try both \texttt{select *} and select field1, field2} type queries.

  6. Use the where clause to limit which records you select

  7. Use the order by clause to change the order in which records are returned

  8. Insert a record into the customer table which contains your own name and address details

  9. Update the price of widgets in the stock\_item table to change their price to \$19.95

When developing database applications, it is often useful to keep a client program such as this one open to test queries or check the state of your data. You can open multiple telnet sessions to our training system to do this if you wish.