From Virtual-Weltanschauung-PmWiki

Main: MySQLCommands

Selecting a database:

mysql> USE database;

Listing databases:

mysql> SHOW DATABASES;

Listing tables in a db:

mysql> SHOW TABLES;

Describing the format of a table:

mysql> DESCRIBE table;

Creating a database:

mysql> CREATE DATABASE db_name;

Creating a table:

mysql> CREATE TABLE table_name (field1_name TYPE(SIZE), field2_name TYPE(SIZE));
->Ex: mysql> CREATE TABLE pet (name VARCHAR(20), sex CHAR(1), birth DATE);

Inserting one row at a time:

mysql> INSERT INTO table_name VALUES ('MyName', 'MyOwner', '2002-08-31');
(Use NULL for NULL)

INSERT INTO users VALUES ('name', 'passwprd', 'blank', '1')

Retrieved from http://www.virtual-weltanschauung.com/pmwiki/pmwiki.php?n=Main.MySQLCommands
Page last modified on May 12, 2006, at 12:40 AM