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

Query Statements and Expressions (U-SQL)

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

The core processing capability of U-SQL is to transform between rowsets using query expressions. This is done by combining query statements in a U-SQL script.

Since the current version of the Azure Data Lake Analytics service is only executing batch scripts, a query expression cannot be returned directly. It always has to be either output into a table with an INSERT statement or a file using an OUTPUT statement, or assigned to a rowset variable.

Syntax U-SQL Query Statements
Query_Statement :=                                                                                       
     Rowset_Variable '=' Query_Expression_With_Fetch.
Rowset_Variable := '@' + Unquoted_Identifier.

Semantics of Syntax Elements

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.

    @someBooks = 
        SELECT * FROM 
            ( VALUES
            ("The Book Thief", "Markus Zusak", "2005"),
            ("The Girl with the Dragon Tattoo", "Stieg Larsson", "2005"),
            ("The Silver Linings Playbook", "Matthew Quick", "2008"),
            ("Sarah's Key", "Tatiana de Rosnay", "2006")
            ) AS T(Book, Author, [Publication Year]);
    
    @rowsetVariable =
        SELECT Book, Author
        FROM @someBooks;
    
    OUTPUT @rowsetVariable
    TO "/ReferenceGuide/DML/QSE/exampleA.txt"
    USING Outputters.Tsv();
    

See Also

© 2018 Microsoft