[Original] MySql syntax and precautions _ MySQL

Source: Internet
Author: User
[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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.