Back in the evening, the classmate said the interview encountered a SQL interview topic, did a bit of their own, summary summary.The topics are as follows: The following is a product data sheet (Product ID, color col, num), each of which is
PL/SQL script language value assignment statement syntax table and record comply with the type usage, select the statement if else usage anonymous block (1), assign value statement syntax PL/SQL values use: = "=" some rules need to be observed in
The great god says: In sql, you can use if else without casebelow to see, specifically why, did not figure out if there is a great God to know to provide the following information:MySQL can be used as an expression, or as a Process control statement
Use of case, simple case functionA simple case expression that uses an expression to determine the return value.
Grammar:
Case Search_expression
When Expression1 THEN RESULT1
When Expression2 THEN result2
...
When Expressionn THEN Resultn
ELSE
MySQL Stored Procedure example. You cannot use begin end in if else. Otherwise, an Error Code: 1064 is reported to solve the Error Code: 1064You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the
To introduce you to the use of if esle in SQL Server stored procedures for your reference. There are two tables in the database, the primary key for table A is automatically growing and is the foreign key of table B and is allowed to be empty
Now
Error code: 1064You have an error in your SQL syntax; check the manual that corresponds to your MySQL Server version for the right syntax to use near
The error is reported because the if else statement in MySQL procedure uses the begin end
Case has two formats. Simple case function and case search function.--Simple case function when ' 1 ' then ' Male ' when ' 2 ' Then ' Women ' Else ' other ' end--case search function case when sex = ' 1 ' Then ' Man '
when sex = ' 2 '
Now we want to insert data to table B through programming, but in the program, it is not allowed to assign null values to the Int type. If no value is assigned, the default value is 0.To solve this problem, If Else of the stored procedure is used.
Now you can programmatically insert data into table B, but in your program you are not allowed to assign null values to the INT type if you do not assign a value to default to 0.To solve this problem, the if Else of the stored procedure is used, and
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.