Table of contents
TOC
Collapse the table of content
Expand the table of content

!= (Not Equal To) (U-SQL)

Michael Rys|Last Updated: 5/15/2018
|
4 Contributors

Tests whether one expression is not equal to another expression (a comparison operator).

Syntax
Not_Equal_To:=                                                                                           
     expression != expression.
Note

U-SQL uses C# null semantics which is 2-valued and not 3-valued as in ANSI SQL.

Semantics of Syntax Elements

  • expression
    Is any valid expression. If the expressions are not of the same data type, the data type for one expression must be implicitly convertible to the data type of the other.

Result Types

Boolean

Examples

  • The examples can be executed in Visual Studio with the Azure Data Lake Tools plug-in.
  • The scripts can be executed locally. An Azure subscription and Azure Data Lake Analytics account is not needed when executed locally.
@somePeople = 
    SELECT * FROM 
        ( VALUES
        (1, "Noah",    100, (int?)10000, new DateTime(2012,05,31), "cell:030-0074321,office:030-0076545"),
        (2, "Sophia",  100, (int?)15000, new DateTime(2012,03,19), "cell:(5) 555-4729,office:(5) 555-3745"),
        (3, "Liam",    100, (int?)30000, new DateTime(2014,09,14), ""),
        (6, "Emma",    200, (int?)8000,  new DateTime(2014,03,08), (string)null),
        (7, "Jacob",   200, (int?)8000,  new DateTime(2014,09,02), "cell:(5) 555-3932"),
        (8, "Olivia",  200, (int?)8000,  new DateTime(2013,12,11), "cell:88.60.15.31,office:88.60.15.32"),
        (9, "Mason",   300, (int?)50000, new DateTime(2016,01,01), "cell:(91) 555 22 82,office:(91) 555 91 99, home:(425) 555-2819"),
        (10, "",       400, (int?)15000, new DateTime(2014,09,14), "cell:91.24.45.40,office:91.24.45.41"),
        (11, "Ethan ", 400, (int?)null,  new DateTime(2015,08,22), "cell:(604) 555-4729,office:(604) 555-3745")
        ) AS T(EmpID, EmpName, DeptID, Salary, StartDate, PhoneNumbers);


// Returns all records where Salary does not contain a null value (non ANSI  behavior)
@result1 = SELECT * FROM @somePeople WHERE Salary != null;
OUTPUT @result1 TO "/Output/ReferenceGuide/Operators/Comparison/Inequality1.txt" USING Outputters.Tsv();

// Returns all records where Salary does not contain a null value
@result2 = SELECT * FROM @somePeople WHERE Salary IS NOT NULL;
OUTPUT @result2 TO "/Output/ReferenceGuide/Operators/Comparison/Inequality2.txt" USING Outputters.Tsv();

// Returns all records where Salary is not 8000 or null (non ANSI  behavior)
@result3 = SELECT * FROM @somePeople WHERE Salary != 8000;
OUTPUT @result3 TO "/Output/ReferenceGuide/Operators/Comparison/Inequality3.txt" USING Outputters.Tsv();

See Also

© 2018 Microsoft