Msql Quick Refrence Page

This page is a quick reveiw of Msql statements, data types, and other little bits of information that need to be looked up often.  For a full description of the statements and other things discussed here see the msql home page .

Msql Statements:

  1. Create:

    CREATE TABLE table_name

            ( col_name col_type [ not null ]

            [, col_name col_type [ not null ] ] . . . )

  2. Drop:

    DROP TABLE table_name

  3. Insert:

    INSERT INTO table_name

            [ ( column [ , column ] . . . )

            VALUES (  value [ , value ] . . . )

  4. Select:

    SELECT  [ table.]column [ , [table.]column ] . . .

            FROM table [ = alias ]  [ , table [ = alias]  ] . . .

            [ WHERE [table.]column OPERATOR VALUE

            [ AND | OR [table.]column OPERATOR VALUE] . . .

            [ ORDER BY [ table.]column [DESC] [, [table.]column [DESC] . . . ]

    OPERATOR can be <, >, = , <= , >= ,  <> , LIKE, RLIKE, or SLIKE

  5. Delete:

    DELETE FROM table_name

            WHERE column OPERATOR value

            [ AND | OR column OPERATOR value ] . . .

    OPERATOR can be <, >, = , <= , >= ,  <> , LIKE, RLIKE, or SLIKE

  6. Update:

    UPDATE table_name

            SET column=value [ , column=value ] . . .

            WHERE column OPERATOR value

            [  AND | OR column OPERATOR value ] . . .

OPERATOR can be <, >, = , <= , >= ,  <> , LIKE, RLIKE, or SLIKE

 

Msql Data Types:

Type Description
char (len) String of charcters
text (len) Variable length string of characters.  The length is used to indicate the expected length of the data. Note: text fields are   slower to access than char fields and cannot be used in an index nor in LIKE tests.
int Signed integer values.
real Decimal or Scientific Notaion real values
uint Unsighed integer values
date Date values in the format of DD-Mon-YYYY; eg., 1-Jan-1997
time Time values stored in 24-hour notaion in the format of HH:MM:SS
money A numeric value with two decimal places

 

Msql Prompt Commands:

\q

Quit (also achieved by entering Ctrl-D)

\g

Go (send the query to the server)

\e

Edit (Edit the previous query with vi)

\p

Print (print the query buffer)