Halaman

Minggu, 17 Oktober 2010

SQL math

What the result of these SQL Statements:

SELECT 1/2, 2 - (2 * (1/2));

SELECT 1 * 1.52, 1.0 * 1.52, 1.0 * 1.520, 1.00 * 1.520;

Please try with any kind of database software!

1 komentar:

  1. mysql> select 1/2, 2 - (2*(1/2));
    +--------+---------------+
    | 1/2 | 2 - (2*(1/2)) |
    +--------+---------------+
    | 0.5000 | 1.0000 |
    +--------+---------------+
    1 row in set (0.00 sec)

    mysql> SELECT 1 * 1.52, 1.0 * 1.52, 1.0 * 1.520, 1.00 * 1.520;
    +----------+------------+-------------+--------------+
    | 1 * 1.52 | 1.0 * 1.52 | 1.0 * 1.520 | 1.00 * 1.520 |
    +----------+------------+-------------+--------------+
    | 1.52 | 1.520 | 1.5200 | 1.52000 |
    +----------+------------+-------------+--------------+
    1 row in set (0.00 sec)

    BalasHapus