Free cookie consent management tool by TermsFeed Policy Generator
  • Azure SQL
  •    3 page views
  • 2024, August 02, Friday

#024 Return only criteria rows in Azure SQL

Como retornar somente as linhas do critério 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" with a specific condition. I'll explain each

part of the code:SELECT
  1. c.*:SELECT

    • : Indicates that the next part of the code will specify which columns will be returned in the query.
    • c.*: Selects all columns from the "erp. Collaborators" (represented by the alias "c").
  2. FROM erp. Contributors AS c

    :
    • FROM: Indicates the table from which the data will be selected.
    • erp. AS c: Specifies the table "erp. Contributors" and assigns a "c" alias to it for easy reference in the other parts of the code.
  3. WHERE c.UF = '
  4. SP' OR c.UF = 'IF'

    :
    • WHERE: Filters results based on a condition.
    • c.UF = 'SP' OR c.UF = 'IF': The condition specifies that only records whose value in the column "UF" is equal to 'SP' or 'IF' will be included in the query.

Therefore, the code returns all columns from the "erp. Collaborators" for records where the "UF" column is equal to 'SP' or 'IF'. This query is useful when you want to obtain specific information about employees who belong to the states of São Paulo (SP) or Sergipe (SE).

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

  • Reading time 1 min 1 seg

avatar
Fabio Santos

Data Scientist and Consultant for Digital and Analytics Solutions


  • Share

Youtube Channel

@fabioms

Subscribe now