SQL
出自TWEmu.no-ip.org
一種資料庫語言
- MySQL
- SQLite
目錄 |
安裝
- Debian
- mysql-server
- sqlite/sqlite3
使用
| 指令 | 功能 | 範例 |
|---|---|---|
| create table table_name(field1, field2, field3, ...); | 建立資料表 | |
| insert into table_name values(data1, data2, data3, ...); | 加入一筆資料 | |
| select columns from table_name where expression; | 查詢資料 | |
| update table_name set field1 = 'field1' where field1='field0'; | 修改或刪除資料 | |
| drop table table_name; | 刪除資料表 |
修飾字
| 修飾字 | 功能 | 範例 |
|---|---|---|
| select ... distinct column from ... | 顯示該欄位不同的值 | |
| select ... from ...where expression ... | 顯示符合該判別式的欄位 | |
| select ... from ... where expression and/or expression ... | 顯示符合該判別式邏輯的欄位 | |
| select ... from ... where column in (data1, data2, ...) ... | 顯示符合該欄位被要求的資料 | |
| select ... from ... where column between data1 and data2 ... | 顯示符合該欄位介於 data1 到 data2 的資料 | |
| select ... from ... where ... like expression ... | 顯示符合該萬用字元格式的資料 | |
| select ... from ... where ... order by column sort_type ... | 照 小至大 asc/ 大至小 desc 排序資料 |
萬用字元
| 字元 | 功能 | 範例 |
|---|---|---|
| % | 0 至多個字元 | |
| _ | 一個字元 |
圖形介面工具
- PHPMyAdmin

