232
Appendix B Getting Started with MySQL
case, files are created in /var/lib/mysql/testdb directory as shown in the fol
lowing command.
[root@conformix]# ls /var/lib/mysql/testdb
customers.frm customers.MYD customers.MYI
[root@conformix]#
The names of these files start with the name used for the table.
Listing Tables
The show tables command lists currently defined tables in the database.
mysql> show tables;
+ +
| Tables_in_testdb |
+ +
| customers |
+ +
1 row in set (0.01 sec)
mysql>
Displaying Table Information
You can display information about each table column by using the describe
command. The following command displays information about recently created table
customers.
mysql> describe customers;
+ + + + + + +
| Field | Type | Null | Key | Default | Extra |
+ + + + + + +
| name | varchar(20) | YES | | NULL | |
| address | varchar(40) | YES | | NULL | |
| phone | varchar(10) | YES | | NULL | |
| dob | date | YES | | NULL | |
+ + + + + + +
4 rows in set (0.01 sec)
mysql>
Adding Data to Tables
Data can be added to a table using the insert command. The following com
mand adds one row to the customers table.
mysql> insert into customers values ( Boota , 135 SB,
Sargodha , 001 946 15 , 1970 01 01 );
Query OK, 1 row affected (0.06 sec)
mysql>
footer
Our partners:
PHP: Hypertext Preprocessor Cheap Web Hosting
JSP Web Hosting
Ontario Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Java Hosting
Cheapest Hosting
Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved