StudentCodingHUB

Use programming to create innovative things.
  • new post

    Saturday, 25 April 2015

    opertor in mysql

    Opertor

    < = >  Evaluates to true if both arguments are equal, even if both conditions are NULL.

    < > ,  !=  Evaluates to true if the two arguments are not equal.

    REGEXP  Evaluates to true if the value of the argument is specified by the REGEXP construction.

    NOT REGEXP Evaluates to true if the value of the argument is not specified by the NOT REGEXP construction.

    use the NULL-safe (<=>) comparison operator, as shown in the following statement:

    SELECT CDName, Department, Category
    FROM CDs
    WHERE Category < = > NULL
    ORDER BY CDName;


    OR

    SELECT CDName, Department, Category
    FROM CDs
    WHERE Category IS NULL
    ORDER BY CDName;


    ---------------------------------------------------------------------------

    SELECT CDName, Category, InStock
    FROM CDs
    WHERE Category IN (‘Blues’, ‘Jazz’)
    ORDER BY CDName;



    select records only whose Category IN     ‘Blues’  OR    ‘Jazz’


    SELECT CDName, InStock+OnOrder-Reserved AS Available
    FROM CDs
    WHERE CDName LIKE ‘%bach%’


    select records  whose CDName contains the word bach  anywhere .
    For example you have to get all records whose CDName   starts with the character 'a'
    WHERE CDName LIKE ‘%a’

    No comments:

    Post a Comment