mysql>
mysql> # create a table called "Item"
mysql> CREATE TABLE Item
-> (
-> id INT PRIMARY KEY,
-> name VARCHAR(20) NOT NULL
-> );
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> # insert 5 records into the "Item" table
mysql> INSERT INTO Item (id, name) VALUES (3,"Beaver");
Query OK, 1 row affected (0.00 sec)
mysql> INSERT INTO Item (id, name) VALUES (1,"Duck");
Query OK, 1 row affected (0.00 sec)
mysql> INSERT INTO Item (id, name) VALUES (4,"Aardvark");
Query OK, 1 row affected (0.00 sec)
mysql> INSERT INTO Item (id, name) VALUES (2,"Elephant");
Query OK, 1 row affected (0.00 sec)
mysql> INSERT INTO Item (id, name) VALUES (5,"Camel");
Query OK, 1 row affected (0.00 sec)
mysql>
mysql> # show all data in the "Item" table
mysql> SELECT * FROM Item;
+----+----------+
| id | name |
+----+----------+
| 3 | Beaver |
| 1 | Duck |
| 4 | Aardvark |
| 2 | Elephant |
| 5 | Camel |
+----+----------+
5 rows in set (0.00 sec)
mysql>
mysql> # show all data in "Item" numerically ordered
mysql> SELECT * FROM Item ORDER BY id;
+----+----------+
| id | name |
+----+----------+
| 1 | Duck |
| 2 | Elephant |
| 3 | Beaver |
| 4 | Aardvark |
| 5 | Camel |
+----+----------+
5 rows in set (0.00 sec)
mysql>
mysql> # show the "name" column in "Item" alphabetically ordered
mysql> SELECT name FROM Item ORDER BY name;
+----------+
| name |
+----------+
| Aardvark |
| Beaver |
| Camel |
| Duck |
| Elephant |
+----------+
5 rows in set (0.00 sec)
mysql>
mysql> # delete this sample table
mysql> DROP TABLE Item;
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql>