If you??™ve
accessed MySQL as a user with permission to create databases, you??™ll see a
message saying that the query was OK and that one row was a?¬? ected.
2 Type USE ajax, followed by
a semicolon, and press Enter or
Return.
creating the database 3
make the database (cont.)
1 If you are using phpMyAdmin, type the name of the database??”I??™m using
the name ajax??”in the Create new database box, and then click Create. (You
can ignore the Collation menu; see extra bits on page 9.)
The resulting page should
show that the database was
created.
2 If phpMyAdmin did not automatically
select the new database for you, use the
drop-down menu on the left to select it.
(phpMyAdmin will likely have already
selected that database for you.)
4 creating the database
make the tables
If you are using the
command-line mysql client,
create the tables in
the database by running
two CREATE TABLE
commands. (See extra
bits on page 10.)
CREATE TABLE departments (
department_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT
PRIMARY KEY,
department VARCHAR(30) NOT NULL,
UNIQUE (department)
);
CREATE TABLE employees (
employee_id INT UNSIGNED NOT NULL AUTO_INCREMENT
PRIMARY KEY,
department_id TINYINT UNSIGNED NOT NULL,
first_name VARCHAR(20) NOT NULL,
last_name VARCHAR(40) NOT NULL,
email VARCHAR(60) NOT NULL,
phone_ext SMALLINT UNSIGNED NOT NULL,
INDEX (department_id),
INDEX (last_name),
UNIQUE (email)
);
creating the database 5
make the tables (cont.
Pages:
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27