1

I'm working with some SQL and trying to understand what is going on.

Within the select there are what seem like variables s.id s.status

with 
    last_transactions as (
        select 
            s.id as station_id, 
            s.status as status,
            case...........

What are these s. items and how do they work?

Falko
  • 995
  • 11
  • 21

4 Answers4

1

. notation is used to reference columns mainly of a table, view etc. schema objects or an aliased name of a schema object as above you have used s as alias name of some table so using s. the part after dot references to the column in that s or table aliased

Himanshu
  • 3,830
  • 2
  • 10
  • 29
1

the s is the table name. s.id means the id column of the s table.

gloria00
  • 265
  • 2
  • 15
1

s. is a reference to the table name that derives from the From clause that probably follows in your query. The part after the . is the column name.

For example s.id means: Column 'id' from table 's'

MarizaV.
  • 11
  • 2
1

S is table alias and through .dot we can access that table column.

Example..

Select S.id from Sample as S

It give you all id's of the sample table.

Meetts
  • 13
  • 7