Free cookie consent management tool by TermsFeed Policy Generator
  • Azure SQL
  •    10 page views
  • 2024, May 29, Wednesday

#008 Generate a list of unique records in Azure SQL

Como gerar uma lista de registros exclusivos 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 "f.Combustibleis" table. I'll explain each

part of the code:
  1. SELECT DISTINCT [PRODUCT]

    :
    • select: Indicates that the next part of the code will specify which columns will be returned in the query.
    • DISTINCT [PRODUCT]: Returns only unique values from the "PRODUCT" column. The DISTINCT operator eliminates duplicates, ensuring that each value in the "PRODUCT" column appears only once in the query output.
  2. FROM [f].[ Fuels]

    :
    • FROM: Indicates the table from which the data will be selected.
    • [f]. [Fuels]: This is the name of the table from which the data will be extracted. The prefix "f." suggests that the table is in a schema called "f".
  3. ORDER BY
  4. [PRODUCT]:ORDER BY

    • : Sorts the results of the query.
    • [PRODUCT]: Sorts the results based on the "PRODUCT" column, in ascending order, i.e. in alphabetical order.
Therefore, the

code returns a list of unique values from the "PRODUCT" column of the "f.Fuels" table, sorted alphabetically. This is useful when you want to get a distinct list of products present in the table.

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

  • Reading time 0 min 58 seg

avatar
Fabio Santos

Data Scientist and Consultant for Digital and Analytics Solutions


  • Share

Youtube Channel

@fabioms

Subscribe now