Wednesday, 6 May 2015

Operator in mysql

Operator in mysql

(++, --, +=, etc.) are not supported.

DECLARE a int default 2;
DECLARE b int default 3;
DECLARE c FLOAT;

SET c=a+b; select 'a+b=',c;
SET c=a/b; select 'a/b=',c;
SET c=a*b; Select 'a*b=',c;

/ Division SET var4=10/3; → 3.3333
DIV Integer division SET var5=10 DIV 3; → 3

No comments:

Post a Comment