- SELECT * FROM `contactinfo_tab`;
- --------------------------------------------------------------------------------
- SELECT `ci_name` FROM `contactinfo_tab`;
- --------------------------------------------------------------------------------
- SELECT * FROM `contactinfo_tab`
- WHERE `ci_id` = '9';
- --------------------------------------------------------------------------------
- SELECT * FROM `contactinfo_tab`
- WHERE `ci_id` = '2'
- OR `ci_id` = '4';
- --------------------------------------------------------------------------------
- SELECT * FROM `contactinfo_tab`
- WHERE `ci_id` BETWEEN '2' AND '5';
- --------------------------------------------------------------------------------
- SELECT * FROM `contactinfo_tab`
- WHERE `ci_address` LIKE '%三民區%';
- --------------------------------------------------------------------------------
- SELECT COUNT(*) AS `num`
- FROM `contactinfo_tab`;
- --------------------------------------------------------------------------------
- SELECT COUNT(*) AS `num`
- FROM `contactinfo_tab`
- WHERE `ci_address` LIKE '%三民區%';
- --------------------------------------------------------------------------------
- SELECT * FROM `contactinfo_tab`
- ORDER BY `ci_birthday` DESC;
- --------------------------------------------------------------------------------
- SELECT * FROM `contactinfo_tab`
- ORDER BY `ci_address` DESC , `ci_id` DESC;
- --------------------------------------------------------------------------------
- SELECT * FROM `contactinfo_tab`
- LIMIT 1 , 5
- --------------------------------------------------------------------------------
- -- 若開始位置為0時, 可忽略--
- SELECT * FROM `contactinfo_tab`
- LIMIT 0 , 5
- 可寫成
- SELECT * FROM `contactinfo_tab`
- LIMIT 5
複製代碼 |