下面小編就為大家帶來一篇用mysql 查詢奇偶數的實例程式碼。小編覺得蠻不錯的,現在就分享給大家,也給大家做個參考。一起跟著小編過來看看吧
1:找id為奇數的行
##
mysql> select * from forum_dummy where id&1 ; +----+-----------+------------+ | id | user_name | dummy_name | +----+-----------+------------+ | 1 | yang | ting | | 3 | yang3 | ting3 | +----+-----------+------------+ 2 rows in set (0.00 sec)
mysql> select * from forum_dummy where id=(id>>1)<<1 ; +----+-----------+------------+ | id | user_name | dummy_name | +----+-----------+------------+ | 2 | yang1 | ting1 | | 4 | yang4 | ting4 | +----+-----------+------------+ 2 rows in set (0.00 sec)
mysql> select conv(101010,2,10); +-------------------+ | conv(101010,2,10) | +-------------------+ | 42 | +-------------------+ 1 row in set (0.00 sec) 2)十进制--》十六进制 引用 mysql> select conv(999,10,16); +-----------------+ | conv(999,10,16) | +-----------------+ | 3E7 | +-----------------+ 1 row in set (0.00 sec)
以上是用mysql 查詢奇偶數的實例程式碼的詳細內容。更多資訊請關注PHP中文網其他相關文章!