Database Reference
In-Depth Information
Activity
Editing Key
Move up a line in the statement history
Up arrow
Move down a line in the statement history
Down arrow
73
Move left one character within a line
Left arrow
Move right one character within a line
Right arrow
Move to beginning of a line
Home
Move to end of a line
End
Delete previous character
Backspace
Delete character below cursor
Delete
FIGURE 3-1
MySQL editing commands
For example, to make a correction in the first line of a command, you can use the Up arrow key to bring
the first line of the incorrect command to the screen, make any necessary changes, and then press the Enter
key. You can then move the second line to the screen, make any necessary changes, and press the Enter key.
You can repeat this process for all the lines in the command. If you need to add a new line, just type it at the
appropriate position.
Some of the examples used in this text change the data in the database. If you plan to work through the
examples using MySQL, you should follow the instructions in this section for re-creating the Premiere data-
base prior to starting the next chapter. The version of the database used in subsequent chapters does not
include these changes.
TABLE CREATION
You use the SQL CREATE TABLE command to create a table by describing its layout. The word TABLE is
followed by the name of the table to be created and then by the names and data types of the columns (fields)
that make up the table. The rules for naming tables and columns vary slightly from one version of SQL to
another. If you have any doubts about the validity of any of the names you have chosen, you should consult
the manual for your version of SQL.
Some common restrictions placed on table and column names by DBMSs are as follows:
￿
The names cannot exceed 18 characters.
￿
The names must start with a letter.
￿
The names can contain only letters, numbers, and underscores (_).
￿
The names cannot contain spaces.
NOTE
Unlike some other versions of SQL, Access SQL permits the use of spaces within table and column names. There is a restric-
tion, however, on the way names that contain spaces are used in SQL commands. When you use a name containing a space
in Access SQL, you must enclose it in square brackets. For example, if the name of the CreditLimit column were changed to
Credit Limit (with a space between Credit and Limit), you would write the column as [Credit Limit] because the name includes
a space.
Search WWH ::




Custom Search