mysql if then else

Learn about mysql if then else, we have the largest and most updated mysql if then else information on alibabacloud.com

MySQL operation query results case-then-else End usage example

Case has two formats. Simple case function and case search function.--Simple Case functionCase SexWhen ' 1 ' Then ' men 'When ' 2 ' then ' women 'Else ' other ' END--case search functioncase If sex = ' 1 ' Then ' man 'When sex = ' 2 ' Then ' women

MySQL operation query results case-then-else End usage example

Case has two formats. Simple case function and case search function.--Simple Case functionCase SexWhen ' 1 ' Then ' men 'When ' 2 ' then ' women 'Else ' other ' END--case search functioncase If sex = ' 1 ' Then ' man 'When sex = ' 2 ' Then ' women

Simple use of the when and then ... else end in MySQL

The data SQL CASE expression is a generic conditional expression that resembles a if/else statement in another language.Case if condition then resultWhen condition then result.............[When ...][ELSE result]ENDThe case clause can be used where

In MySQL, case, then else end usage

Conditional statementsdelimiter \\CREATE PROCEDURE proc_if ()BEGIN      declare i int default 0;   if i = 1 THEN       SELECT 1;   ELSEIF i = 2 THEN       SELECT 2;   ELSE       SELECT 7;   END IF;END\\delimiter ;Looping statementsWhile

Use LOCATE and case when... THEN... ELSE... END in mysql in combination,

Use LOCATE and case when... THEN... ELSE... END in mysql in combination, In the previous project, you need to write an SQL statement to find out A survey details. Select answer A, Answer B, and answer C... f. The number of people in the answer is

Usage of the key word in MYSQL when the then else end

Explain:1 SELECT 2 Case -------------If3 whenSex='1' Then 'male' -------------sex= ' 1 ', the return value ' male '4 whenSex='2' Then 'female' -------------sex= ' 2 ', the return value ' female '5

When and if else in MySQL

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

The use of case-then-else end in MYSQL

Easy to understand, directly on the example:SELECTCase-------------ifWhen sex= ' 1 ' Then ' Men '-------------sex= ' 1 ', then return value ' Male 'When sex= ' 2 ' Then ' Women '-------------sex= ' 2 ', then the return value ' female 'else 0---------

The use of case-then-else end in MYSQL

Explain:SELECTCase-------------IfWhen the sex= ' 1 ' then ' Male '-------------sex= ' 1 ', the return value ' male 'When the sex= ' 2 ' then ' female '-------------sex= ' 2 ', the return value ' female 'else 0 return ' other '-------------otherEnd---

The use of case-then-else end in MYSQL

Explain:SELECTCase-------------IfWhen the sex= ' 1 ' then ' Male '-------------sex= ' 1 ', the return value ' male 'When the sex= ' 2 ' then ' female '-------------sex= ' 2 ', the return value ' female 'else 0 return ' other '-------------otherEnd---

Total Pages: 15 1 2 3 4 5 .... 15 Go to: Go

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.