what does this symbol mean := in sql
Asked Answered
S

1

13

What does this mean

:=

in sql ?

If found some sql using like that symbol example

select col1, col2, @pv:=col3 as 'col3' from table1
join
(select @pv:=1)tmp
where col1=@pv
Schuck answered 19/12, 2014 at 6:47 Comment(1)
:= is assignment operator.Frangible
T
14

using this: here variable are prepended with an @ sign to suggest user-defined variable.A variable, without @, is a system variable, which you cannot define yourself.

SET  @pv:=1// we set a variable

i.e := is used as assignment operator like normal = else where.

see here:http://dev.mysql.com/doc/refman/5.0/en/user-variables.html

and also see a good post here:MySQL: @variable vs. variable. Whats the difference?

Teeny answered 19/12, 2014 at 6:52 Comment(2)
Thank you.what about the @ ?Schuck
@Schuck @ sign to suggest user-defined variable.Teeny

© 2022 - 2024 — McMap. All rights reserved.