A Taste of MySql 函数(3)

mysql> select cos(pi());
+-----------+
| cos(pi()) |
+-----------+
|        -1 |
+-----------+
1 row in set (0.00 sec)

mysql> select sin(pi());
+---------------------+
| sin(pi())           |
+---------------------+
| 1.2246063538224e-16 |
+---------------------+
1 row in set (0.00 sec)

mysql> select sin(1);
+-----------------+
| sin(1)          |
+-----------------+
| 0.8414709848079 |
+-----------------+
1 row in set (0.00 sec)

mysql> select sin(pi());
+---------------------+
| sin(pi())           |
+---------------------+
| 1.2246063538224e-16 |
+---------------------+
1 row in set (0.00 sec)

mysql> select tan(pi());
+----------------------+
| tan(pi())            |
+----------------------+
| -1.2246063538224e-16 |
+----------------------+
1 row in set (0.00 sec)

mysql> select tan(pi()+1);
+-----------------+
| tan(pi()+1)     |
+-----------------+
| 1.5574077246549 |
+-----------------+
1 row in set (0.00 sec)

mysql> select asin(1);
+-----------------+
| asin(1)         |
+-----------------+
| 1.5707963267949 |
+-----------------+
1 row in set (0.00 sec)

mysql> select acos(1);
+---------+
| acos(1) |
+---------+
|       0 |
+---------+
1 row in set (0.00 sec)

mysql> select atan(2);
+-----------------+
| atan(2)         |
+-----------------+
| 1.1071487177941 |
+-----------------+
1 row in set (0.00 sec)

mysql> select rand();
+------------------+
| rand()           |
+------------------+
| 0.28359896995462 |
+------------------+
1 row in set (0.00 sec)

mysql> select now();
+---------------------+
| now()               |
+---------------------+
| 2009-10-20 22:58:58 |
+---------------------+
1 row in set (0.00 sec)

mysql> select sysdate();
+---------------------+
| sysdate()           |
+---------------------+
| 2009-10-20 22:59:09 |
+---------------------+
1 row in set (0.00 sec)

mysql> select current_timestamp();
+---------------------+
| current_timestamp() |
+---------------------+
| 2009-10-20 22:59:58 |
+---------------------+
1 row in set (0.00 sec)

mysql> select current_timestamp()+0;
+-----------------------+
| current_timestamp()+0 |
+-----------------------+
| 20091020230744.000000 |
+-----------------------+

1 row in set (0.00 sec)

mysql>
mysql>
mysql>
mysql>
mysql> select cast(1-2 as unsigned);
+-----------------------+
| cast(1-2 as unsigned) |
+-----------------------+
|  18446744073709551615 |
+-----------------------+
1 row in set (0.01 sec)
对于负数,返回最大的整数。
mysql> select cast(-2 as unsigned);
+----------------------+
| cast(-2 as unsigned) |
+----------------------+
| 18446744073709551614 |
+----------------------+
1 row in set (0.00 sec)

mysql> select cast(1 as unsigned);
+---------------------+
| cast(1 as unsigned) |
+---------------------+
|                   1 |
+---------------------+
1 row in set (0.00 sec)

mysql> select convert(-1, unsigned);
+-----------------------+
| convert(-1, unsigned) |
+-----------------------+
|  18446744073709551615 |
+-----------------------+
1 row in set (0.00 sec) 

你可能感兴趣的:(mysql)