Free cookie consent management tool by TermsFeed Policy Generator
  • Azure SQL
  •    2 page views
  •   0 video views
  • 2024, August 30, Friday

#012 Return all ordered rows in Azure SQL

Como retornar todas as linhas ordenadas em Consulta (SELECT) existente na linguagem de Manipulação de Dados (DML) do Azure SQL/SQL Server

This T-SQL code performs a query on the "erp. Collaborators". I'll explain each part

of the code:SELECT
  1. Contributor, Admission AS FirstDay

    :
    • SELECT: Indicates that the next part of the code will specify which columns will be returned in the query.
    • Collaborator: This is the column that will be selected.
    • AS FirstDay Admission: Select the "Admission" column and rename it "FirstDay". Using AS allows you to rename the column in the query output.
  2. FROM erp. Collaborators

    :
    • FROM: Indicates the table from which the data will be selected.
    • erp. Collaborators: This is the name of the table from which the data will be extracted. The prefix "erp." suggests that the table is in a schema called "erp."
  3. ORDER BY
  4. FirstDay ASC:

    • ORDER BY: Sorts the results of the query.
    • FirstDay ASC: Sorts the results based on the "FirstDay" column, ascending (ASC), i.e. from lowest to highest value. This means that the list will be sorted by the days of employee onboarding in ascending order.

Therefore, the code returns the employees and the date of admission (renamed to "FirstDay") from the "erp. Employees", ordered by the first day of admission in ascending order. This query is useful when you want to view the list of collaborators sorted by their admission dates.

This content contains
  • Content Imagem
  • Language Portuguese
  • Duration
  • Subtitles Não

  • Reading time 1 min 7 seg

avatar
Fabio Santos

Data Scientist and Consultant for Digital and Analytics Solutions


  • Share

Youtube Channel

@fabioms

Subscribe now