The new feature tutorial of MySQL 5.0 is intended for old users who need to have a better understanding of the new features of MySQL 5.0 (the best combination with PHP. Simply put, I introduced the "Stored Procedure, trigger, view, and Information Architecture View". I would like to thank the translator Chen Pengyi for his efforts.
I hope this book will be able to talk to you like an expert, so that you can learn the required knowledge with simple questions and examples. In order to achieve this purpose, I will gradually establish concepts for everyone from every detail, and finally show you a large practical example, before learning, you may think that this case is very difficult, but as long as you follow the course, I believe you will be able to master it soon.
Conventions and Styles Conventions and programming Styles
Every time I want to demonstrate the actual code, I will adjust the code displayed on the screen of the MySQL (best combination with PHP) client and change the font to Courier, make them look different from common text.
Here is an example: MySQL (the best combination with PHP)> drop function f; Query OK, 0 rows affected (0.00 sec)
If the instance is large, you need to add comments between some rows and paragraphs. At the same time, I will place the '<--' symbol on the right side of the page to emphasize.
For example:
- MySQL (best combination with PHP)> create procedure p ()-> BEGIN/* This procedure does nothing */<---> END; // Query OK, 0 rows affected( 0.00 sec)
Sometimes I will remove the "MySQL (the best combination with PHP)>" and "->" system display in the example, you can directly copy the code to the MySQL (the best combination with PHP) client program. If you are not reading an electronic version, you can use MySQL (the best combination with PHP ). so the examples have been tested on Suse 9.2 Linux and MySQL (the best combination with PHP) 5.0.3 public edition.
When you read this book, MySQL (the best combination with PHP) already has a higher version and supports more operating systems, including Windows, Linux, and HP-UX. So the example here will run normally on your computer. However, if the operation still fails, you can consult your senior MySQL (the best combination with PHP) users for long-term support and help.
Therefore, stored procedures are reusable components! Imagine if you change the host language, this will not affect the stored procedure, because it is a database logic rather than an application. Stored procedures can be transplanted! When you use SQL to write a stored procedure, you will know that it can run on any platform supported by MySQL (the best combination with PHP). You do not need to add additional runtime environment packages, you do not need to set the permission for the program in the operating system, or the Stored Procedure for your different models of computers will be saved! If you have compiled a program, such as displaying the withdrawal of check in bank transaction processing, you can find your program for anyone who wants to know the check.
It is stored in the database as source code. This will make a meaningful association between data and the process of data processing. This may be the same as what you said in the planning theory you have heard in your class. Stored procedures can be migrated!
MySQL (the best combination with PHP) fully supports the SQL 2003 standard. Some databases such as DB2 and Mimer are also supported. However, some of them are not supported, such as Oracle (a large-scale website database platform) and SQL server (a powerful database platform on WINDOWS. We will provide enough help and tools to make it easier for code written for other DBMS to be transferred to MySQL (the best combination of PHP and PHP.
Setting up with MySQL (the best combination with PHP) 5.0 set and start the MySQLMySQL 5.0 Service
Pass
- MySQL (best combination with PHP) _ fix_privilege_tables
Or
~ /MySQL (the best combination with PHP)-5.0/scripts/MySQL (the best combination with PHP) _ install_db
To start the MySQL (the best combination with PHP) service.
As part of our exercise preparation, I assume that MySQL (the best combination with PHP) 5.0 has been installed. If you do not have a database administrator to install the database and other software for you, you need to install it on your own. But one thing you can easily forget is that you need a table named MySQL (the best combination with PHP). proc.
After the latest version is installed, you must run
- MySQL (best combination with PHP) _ fix_privilege_tables
Or
MySQL (best combination with PHP) _ install_db
You only need to run one of them) -- otherwise the stored procedure will not work. I also enable an informal SQL script after the root identity, as shown below:
MySQL (best combination with PHP)> source/home/pgulutzan/MySQL (best combination with PHP)-5.0/scripts/MySQL (best combination with PHP) _ prepare_privilege_tables_for_5. SQL
Starting the MySQL (the best combination with PHP) Client starts the MySQL (the best combination with PHP) Client
This is how I start the MySQL (best combination with PHP) client. You may use other methods. If you are using a binary or Windows computer, you may run the following programs in other subdirectories:
- Easy @ PHPv: ~> /Usr/local/MySQL (the best combination with PHP)/bin/MySQL (the best combination with PHP) -- user = root
- Welcome to the MySQL (the best combination with PHP) monitor. Commands end with; or \ g.
- Your MySQL (best combination with PHP) connection id is 1 to server version: 5.0.3-alpha-debug
- Type 'help; 'or' \ H' for help. Type '\ C' to clear the buffer.
In the demo, I will display the results returned by the MySQL (best combination with PHP) Client After Login as root, which means that I have great privileges.
The above content introduces the stored procedure of the new MySQL 5.0 tutorial.