Table transformation


#1

Hi i have a doubt. Why use +1 in this case?

SELECT origin, id,
(SELECT COUNT(*)
FROM flights f
WHERE f.id < flights.id
AND f.origin=flights.origin) + 1
AS flight_sequence_number
FROM flights;


#2

This post was flagged by the community and is temporarily hidden.


#3

Hey, that' s not my problem. I just would like to know the meaning of the +1. I took this example from the curse Table Transformation.

Thanks, Offline


#4

This post was flagged by the community and is temporarily hidden.


#5

This post was flagged by the community and is temporarily hidden.


#6

Thanks, i already searched about this. But i can't find a believable answer.


#7

This post was flagged by the community and is temporarily hidden.


#8

This post was flagged by the community and is temporarily hidden.


#9

Yea, i can pass very easily the level. My problem is that they put there this example with this part " +1" and they don't even explain it. I just would like know why i should use it or not.


#10

How can it's may be
flights.id < flights.id ?
it's look wrong!


#11

Hy bytemaster90052, i just got the course example. I thought the same about being or not being wrong. But i've the feeling that this statement is related about the order of execution.


#12