Professional Documents
Culture Documents
D62048GC10
Edition 1.0
D63883
Trademark Notice
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective
owners.
AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro
Devices. Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used
under license and are trademarks or registered trademarks of SPARC International, Inc. UNIX is a registered trademark
licensed through X/Open Company, Ltd.
Preface
iii
Preface
Computer input and output is printed in this format: Computer input or output. This is also used
for the names of executable programs and file locations.
Keywords from the SQL language appear in this format: SQL KEYWORD. SQL keywords are not case
sensitive and may be written in any letter case, but the training guide uses uppercase.
Placeholders for user input inside appearing inside computer input appear in this format: <user input>
When commands are shown that are meant to be executed from within a particular program, the prompt shown
preceding the command indicates which command to use. For example, shell> indicates a command that you
execute from your shell, and mysql> indicates a statement that you execute from the mysql client program:
shell> mysql -u root -h 127.0.0.1
mysql> SELECT * FROM world.City;
The shell is your command interpreter. On Linux, this is typically a program such as sh, csh, or bash. On
Windows, the equivalent program is command.com or cmd.exe, typically run in a console window. When you enter
a command or statement shown in an example, do not type the prompt shown in the example.
Database, table, and column names must often be substituted into statements. To indicate that such substitution is
necessary, this manual uses db_name, tbl_name, and col_name. For example, you might see a statement like
this:
mysql> SELECT col_name FROM db_name.tbl_name;
This means that if you were to enter a similar statement, you would supply your own database, table, and column
names for the placeholdes db_name, tbl_name, and col_name., perhaps like this:
mysql> SELECT author_name FROM biblio_db.author_list;
In syntax descriptions, square brackets ([ and ]) indicate optional words or clauses. For example, in the following
statement, IF EXISTS is optional:
DROP TABLE [IF EXISTS] tbl_name;
When a syntax element consists of a number of alternatives, the alternatives are separated by vertical bars (pipe, |).
When one member from a set of choices may be chosen, the alternatives are listed within square brackets ([ and ]):
TRIM([[BOTH | LEADING | TRAILING] [remstr] FROM] str)
When one member from a set of choices must be chosen, the alternatives are listed within braces ({ and }):
{DESCRIBE | DESC} tbl_name [col_name | wild]
iv
Preface
An ellipsis (...) indicates the omission of a section of a statement, typically to provide a shorter version of more
complex syntax. For example, INSERT ... SELECT is shorthand for the form of INSERT statement that is
followed by a SELECT statement.
An ellipsis can also indicate that the preceding syntax element of a statement may be repeated. In the following
example, multiple reset_option values may be given, with each of those after the first preceded by commas:
RESET reset_option[, reset_option] ...
Commands for setting shell variables are shown using Bourne shell syntax. For example, the sequence to set the CC
environment variable and run the configure command looks like this in Bourne shell syntax:
shell> CC=gcc ./configure
If you are using csh or tcsh, you must issue commands somewhat differently:
shell> setenv CC gcc
and
shell> ./configure
Preface
123
vi
NAME
DESCRIPTION
Preparation
Written exam
Inline Lab
Throughout the course the instructor will conduct labs in line with
the instruction, which are designed to help you to understand the
nuts and bolts (inner-workings) of the topic.
Further Practice
Lab
Student notes
Preface
Acknowledgments
Sun Microsystems would like to thank the many individuals that played a part in bringing this training material to
the numerous students who will benefit from the knowledge and effort that each of these contributors put into the
training. Even though there were a large number of contributions from many Sun Microsystems' employees, the
following list of contributors played a vital role in developing this material and ensuring that its contents were
accurate, timely and most of all presented in a way that would benefit those that are utilizing it for the benefit of
improving their skills with MySQL.
Jeffrey Gorton - Course Developer and Editor
Max Mether - Course Development Manager
Kai Voigt - Lead Instructor/Subject Matter Expert
Tom Hanlon Subject Matter Expert
vii
Preface
Course Objectives
Through a hands-on approach, this instructor-led course will help you add to your knowledge the skills to combine
PHP and MySQL with time-proven database management techniques to create best-of-breed web applications that
are efficient, solid and secure. At the completion of this course you should be able to:
Use the basic components of PHP to build a foundation for more complex web applications
Understand the basic components of MySQL to build a foundation for the development of fully dynamic
and database-driven sites
Use SQL query commands to retrieve data from the MySQL Database
Change table data using the SQL Data Manipulation Language (DML) commands
Create web based forms that interact with the end user and the data within MySQL
xi
Preface
Table of Contents
1 Introduction............................................................................................................................. 1-0
1.1 Learning Objectives......................................................................................................... 1-1
1.2 MySQL Overview............................................................................................................1-2
1.2.1 Sun Acquisition........................................................................................................ 1-2
1.2.2 MySQL Partners.......................................................................................................1-3
1.3 MySQL Products............................................................................................................. 1-4
1.3.1 MySQL Database Server Products...........................................................................1-4
1.3.2 MySQL GUI Tools................................................................................................... 1-4
1.3.3 MySQL Connectors..................................................................................................1-5
1.3.4 Solutions for Embedding MySQL........................................................................... 1-6
1.4 MySQL Services.............................................................................................................. 1-7
1.4.1 MySQL Training...................................................................................................... 1-7
1.4.2 MySQL Certification................................................................................................1-7
1.4.3 MySQL Consulting.................................................................................................. 1-7
1.4.4 MySQL Support....................................................................................................... 1-7
1.5 The MySQL Enterprise Subscription...............................................................................1-9
1.5.1 MySQL Enterprise Server........................................................................................ 1-9
1.5.2 24x7 Production Support..........................................................................................1-9
1.5.3 MySQL Enterprise Monitor................................................................................... 1-10
1.5.4 Obtaining a MySQL Enterprise Subscription........................................................ 1-11
1.6 Supported Operating Systems........................................................................................1-13
1.7 MySQL Certification Program.......................................................................................1-14
1.8 Training Curriculum Paths.............................................................................................1-15
1.9 MySQL Website.............................................................................................................1-19
1.9.1 MySQL Community Web Page..............................................................................1-20
1.9.2 MySQL Online Documentation............................................................................. 1-22
1.10 Chapter Summary........................................................................................................ 1-25
2 LAMP...................................................................................................................................... 2-1
2.1 Learning Objectives......................................................................................................... 2-2
2.2 LAMP Architecture..........................................................................................................2-3
2.3 Apache Server.................................................................................................................. 2-4
2.3.1 Understanding the World Wide Web........................................................................ 2-4
2.3.2 Client Side vs. Server Side scripting........................................................................2-6
2.4 The MySQL Database......................................................................................................2-7
2.4.1 What is a RDBMS?.................................................................................................. 2-7
2.4.2 Entities and Relationships........................................................................................ 2-8
2.4.3 RDBMS Database Structure.................................................................................... 2-9
2.5 PHP................................................................................................................................ 2-10
2.5.1 How is PHP used?.................................................................................................. 2-10
2.5.2 How does PHP work?.............................................................................................2-11
2.5.3 PHP Design Consideration.....................................................................................2-12
2.5.4 Comparing PHP to other tools............................................................................... 2-13
2.6 Installing XAMPP..........................................................................................................2-15
2.7 Chapter Summary.......................................................................................................... 2-20
3 PHP Foundations..................................................................................................................... 3-1
3.1 Learning Objectives......................................................................................................... 3-2
3.2 Delimiting PHP Code...................................................................................................... 3-3
xii
Preface
xiii
Preface
xiv
Preface
12 Conclusion........................................................................................................................... 12-1
12.1 Course Overview......................................................................................................... 12-2
12.2 Training and Certification Website............................................................................. 12-3
12.3 Course Evaluation........................................................................................................12-5
12.4 Thank you!................................................................................................................... 12-6
12.5 Q&A Session................................................................................................................12-7
Appendix A Solutions................................................................................................Appendix A-0
Appendix B Session Handling Configuration Options............................................. Appendix B-0
Appendix C Common Programming Tools...............................................................Appendix C-0
xv