MySQL: Mathematical expression

This entry is part 24 of 26 in the series Learn MySQL

Select statements typically refer to some table or tables from which you’re retrieving rows.

However, in MySQL, select need not reference any table at all, which means that you can use the mysql program as a calculator for evaluating an expression.

select (28 + 52) / sqrt(64);

The above expression evaluates to 10.



Series Navigation<< MySQL: Numbering query output lines
MySQL: String comparison >>

Leave a comment

Leave a Reply