[Original] MySql syntax and precautions bitsCN.com
MySql database operations are used in recent projects, because most of the projects written in C # previously use SQL and Orale databases, you may be familiar with writing SQL database stored procedures and test statements, but you know much about MySql stored procedures and syntax.
C # to operate a MySQL database, you can use the open-source class library mysql. data. dll. this operation is similar to the operation class of the SQL database. this chapter does not cover this content for the time being. I only want to write some MySql syntaxes and precautions:
The content of this section is as follows:
(1) how MySql defines variables
(2) how to write MySql comments
(3) How to store MySql procedures (with return parameters)
(4) how to execute the MySql stored procedure (with return parameters)
(5) How to write the judgment statement in MySql
(6) execute the MySql stored procedure and write Chinese characters into the database with garbled characters
Let's get started.
I. How does MySql define variables?
Declare is the first thought of by SQL developers. But is MySQl like this? after testing, if you are writing a stored procedure, you can use Declare instead of a stored procedure, but you should use the Set keyword when writing some test cases. For example:
Define variables in stored procedures
Create procedure 'test' (username CHAR (20) begin declare nickID INT;
BitsCN.com