Database Reference
In-Depth Information
Getting Started with Access 2007 and 2010
If you are using Access 2007 or 2010 and the Premiere Products database provided with the Data Files for
this text, the tables in the database have already been created. You will not need to execute the CREATE
TABLE commands to create the tables or the INSERT commands to add records to the tables.
To execute SQL commands shown in the figures in Access 2007 or 2010, open the Premiere Products
database, click the Create tab on the Ribbon, click the Query Design button in the Other group in Access
2007 or in the Queries group in Access 2010, click the Close button in the Show Table dialog box, click the
View button arrow in the Results group on the Query Design Tools tab, and then click SQL View. The Query1
tab displays the query in SQL view, ready for you to type your SQL commands. To run the SQL command,
click the Run button in the Results group on the Query Tools Design tab. To return to SQL view, click the
View button arrow in the Views group on the Home tab, and then click SQL View.
Unlike other SQL implementations, Access doesn
72
t have a DECIMAL data type. To create numbers with
decimals, you must use either the CURRENCY or NUMBER data type. Use the CURRENCY data type for fields
that will contain currency values; use the NUMBER data type for all other numeric fields.
In Access, you can correct typing errors in a command just as you would correct errors in a document,
by using the keyboard arrow keys to move the insertion point and using the Backspace or Delete keys to
delete text. After making your corrections, you can run the query again.
Some of the examples in this text change the data in the database. If you plan to work through the exam-
ples using Access, you should use a copy of the original Premiere Products database because the version of
the database that is used in subsequent chapters does not include these changes.
'
Getting Started with MySQL
If you use the MySQL-Premiere script provided with the Data Files for this text to create and activate the
Premiere (Products) database, the script will activate the database, create the tables, and insert the records
for you. You will not need to execute the CREATE TABLE commands to create the tables or the INSERT
commands to add records to the tables. (Note: This script file assumes you have not previously created the
database or any of the tables in the database. If you have created any of the tables, you should run the
MySQL-DropPremiere script provided with the Data Files for this topic prior to running the MySQL-Premiere
script.)
To run a script in MySQL, type the SOURCE command followed by the name of the file, and then press
the Enter key. For example, to run a script named MySQL-Premiere, you would type the following command:
SOURCE MySQL-Premiere
Before typing commands in MySQL, you must activate the database by typing the USE command followed
by the name of the database; for example, to activate the Premiere Products database, the command is USE
PREMIERE. After the database is activated, all commands are assumed to pertain to the activated database.
To activate a different database during the current session, you execute the USE command again with the
new database name. After typing any MySQL command, press the Enter key. MySQL moves the cursor to the
next line and displays the continuation indicator (-
). After typing the last line of a command, type a semico-
lon, and then press the Enter key to execute the command and display the results.
As you are working in MySQL, the most recent command you entered is stored in a special area of mem-
ory called the statement history. You can edit the command in the statement history by using the editing
keys shown in Figure 3-1.
>
Search WWH ::




Custom Search