1. w3schools.com
        THE WORLD'S LARGEST WEB DEVELOPER SITE

        SQL Tutorial

        SQL HOMESQL IntroSQL SyntaxSQL SelectSQL Select DistinctSQL WhereSQL And, Or, NotSQL Order BySQL Insert IntoSQL Null ValuesSQL UpdateSQL DeleteSQL Select TopSQL Min and MaxSQL Count, Avg, SumSQL LikeSQL WildcardsSQL InSQL BetweenSQL AliasesSQL JoinsSQL Inner JoinSQL Left JoinSQL Right JoinSQL Full JoinSQL Self JoinSQL UnionSQL Group BySQL HavingSQL ExistsSQL Any, AllSQL Select IntoSQL Insert Into SelectSQL CaseSQL Null FunctionsSQL Stored ProceduresSQL Comments

        SQL Database

        SQL Create DBSQL Drop DBSQL Backup DBSQL Create TableSQL Drop TableSQL Alter TableSQL ConstraintsSQL Not NullSQL UniqueSQL Primary KeySQL Foreign KeySQL CheckSQL DefaultSQL IndexSQL Auto IncrementSQL DatesSQL ViewsSQL InjectionSQL Hosting

        SQL References

        SQL KeywordsMySQL FunctionsSQL Server FunctionsMS Access FunctionsSQL OperatorsSQL Data TypesSQL Quick Ref

        SQL Examples

        SQL ExamplesSQL QuizSQL ExercisesSQL Certificate

        MySQL IF() Function

        ❮ MySQL Functions

        Example

        Return "YES" if the condition is TRUE, or "NO" if the condition is FALSE:

        SELECT IF(500<1000, "YES", "NO");
        Try it Yourself »

        Definition and Usage

        The IF() function returns a value if a condition is TRUE, or another value if a condition is FALSE.

        Syntax

        IF(condition, value_if_true, value_if_false)

        Parameter Values

        Parameter Description
        condition Required. The value to test
        value_if_true Optional. The value to return if condition is TRUE
        value_if_false Optional. The value to return if condition is FALSE

        Technical Details

        Works in: From MySQL 4.0

        More Examples

        Example

        Return 5 if the condition is TRUE, or 10 if the condition is FALSE:

        SELECT IF(500<1000, 5, 10);
        Try it Yourself »

        Example

        Test whether two strings are the same and return "YES" if they are, or "NO" if not:

        SELECT IF(STRCMP("hello","bye") = 0, "YES", "NO");
        Try it Yourself »

        Example

        Return "MORE" if the condition is TRUE, or "LESS" if the condition is FALSE:

        SELECT OrderID, Quantity, IF(Quantity>10, "MORE", "LESS")
        FROM OrderDetails;
        Try it Yourself »

        ❮ MySQL Functions

            1. http://www.h6e3wgta.tw | http://m.h6e3wgta.tw | http://wap.h6e3wgta.tw | http://3g.h6e3wgta.tw | http://4g.h6e3wgta.tw | http://5g.h6e3wgta.tw | http://mobile.h6e3wgta.tw | http://vip.h6e3wgta.tw | http://ios.h6e3wgta.tw | http://anzhuo.h6e3wgta.tw | http://7.h6e3wgta.tw | http://5b.h6e3wgta.tw | http://f49fc.h6e3wgta.tw | http://d808.h6e3wgta.tw | http://5.h6e3wgta.tw | http://c40a.h6e3wgta.tw | maya玛雅国内精品