Building Chinese Web Sites using PHP
Dr. Herong Yang, Version 2.11

Creating a Test Table - Comment

This section describes how to create a new table for testing purpose with MySQL monitor.

In order to perform database related tests on MySQL server, I created a new table called "Comment" with MySQL Monitor:

C:\>\local\mysql\bin\mysql -u herong -pTopSecret

mysql> USE HerongDB;
Database changed

mysql> CREATE TABLE Comment (ID INTEGER PRIMARY KEY AUTO_INCREMENT,
    ->   Name VARCHAR(256), Comment LONGTEXT);
Query OK, 0 rows affected (0.02 sec)

mysql> INSERT INTO Comment (Name, Comment)
    ->   VALUES ('Herong', 'This is a test.');
Query OK, 1 row affected (0.36 sec)

mysql> SELECT * FROM Comment;
+----+--------+-----------------+
| ID | Name   | Comment         |
+----+--------+-----------------+
|  1 | Herong | This is a test. |
+----+--------+-----------------+
1 row in set (0.00 sec)

Note that table "Comment" has 3 columns:

  • ID - An INTEGER column with auto-incremented values as primary keys.
  • Name - A VARCHAR column to store the name of the visitor as a character stirng.
  • Comment - A LONGTEXT column to store visitor's comment as large text data.

Sections in This Chapter

MySQL 5.0 Download, Installation and Start

mysqladmin - MySQL Admin Tool

mysql - Command Line Tool

Creating Database and User with MySQL Monitor

Creating a Test Table - Comment

Dr. Herong Yang, updated in 2007
Creating a Test Table - Comment