SQL 方言參考/管理
外觀
< SQL 方言參考
雖然這個主題不直接關於 SQL 語言,但它足夠接近,可以收集有關經常進行的管理任務的資訊。
資料庫轉儲涉及建立包含所有資料(行)和來自所需資料庫/表的這些資料的模式的檔案。通常情況下,它以一系列 SQL 語句的形式完成,將 CREATE DATABASE / CREATE TABLE 語句組合起來以重新建立模式,並將 INSERT 語句組合起來以重新填充行——因此,通常情況下,生成的檔案可以透過簡單地執行查詢來使用命令列 SQL 客戶端直接匯入。但是,有時需要其他輸出格式,並且一些資料庫(至少是 MSSQL)缺乏從命令列轉儲客戶端序列化資料庫為 SQL 語句的能力。
| SQL 版本 | 功能 | 標準 SQL:2011 |
DB2 | Firebird | Ingres | Linter | MSSQL | MySQL | MonetDB | Oracle Vers. 11.x |
PostgreSQL | SQLite | Virtuoso |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ? | 基本呼叫 | ? | ? | ? | copydb dbname options | ? | bcp database out file options | mysqldump options database | msqldump -d database | ? | pg_dump options database | sqlite3 dbfile .dump | ? |
| ? | 對目標伺服器進行身份驗證 | ? | ? | ? | -uusername -P | ? | -U username -P password -S host | -uusername -ppassword -hhost -Pport | -uusername | ? | -Uusername -Wpassword | N/A | ? |
| ? | 將轉儲儲存到檔案 | ? | ? | ? | ? | ? | 在基本呼叫中 | -rfile / --result-file=file | 重定向 msqldump 輸出 | ? | -ffile / --file=file | .output file .once file |
? |
| ? | 僅轉儲模式 | ? | ? | ? | ? | ? | N/A | -d / --no-data | msqldump -d "database" -D | ? | -s / --schema-only | .schema | ? |
| ? | 在開始處新增 DROP 模式 | ? | ? | ? | -add_drop | ? | N/A | N/A | ? | -c | N/A | ? | |
| ? | 防止轉儲訪問許可權 | ? | ? | ? | ? | ? | N/A | N/A | N/A | ? | -x / --no-privileges / --no-acl | N/A | ? |
| ? | 僅轉儲資料 | ? | ? | ? | ? | ? | 預設 | -n -t / --no-create-db --no-create-info | -t tablename | ? | -s / --data-only | N/A | ? |
| ? | 以製表符分隔的形式轉儲資料 | ? | ? | ? | ? | ? | 預設 | --tab=path / -Tpath | ? | ? | ? | .mode tabs | ? |
| ? | 以 INSERT 語句的形式轉儲資料 | ? | ? | ? | ? | ? | N/A | 預設 | 預設 | ? | -d | .mode insert | ? |
| ? | 將所有內容轉儲為 XML 檔案 | ? | ? | ? | ? | ? | N/A | --xml / -X | N/A | ? | N/A | N/A | ? |
| ? | 資料的排序 | ? | ? | ? | ? | ? | -h "ORDER (column, ...)" | --order-by-primary | ? | ? | ? | ? | ? |
| SQL 版本 | 功能 | 標準 SQL:2011 |
DB2 | Firebird | Ingres | Linter | MSSQL | MySQL | MonetDB | Oracle Vers. 11.x |
PostgreSQL | SQLite | Virtuoso |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ? | 基本呼叫 | ? | ? | ? | sql options database | ? | sqlcmd options | mysql options [database] | mclient -d database | ? | psql options [database] | sqlite3 filename options | ? |
| ? | 對目標伺服器進行身份驗證 | ? | ? | ? | -uusername -Ppassword -Ggroup -Rrole | ? | -S host -d database -U username -P password | -uusername -ppassword -hhost -Pport | ? | ? | -Uusername -Wpassword -hhost -pport | N/A | ? |
| ? | 從命令列執行查詢並退出 | ? | ? | ? | N/A | ? | -Q query | -e query | -sstatement | ? | -c query | query | ? |
| ? | 從命令列執行查詢並繼續使用互動式提示符 | ? | ? | ? | N/A | ? | -q query | N/A | -i | ? | N/A | N/A | ? |
| ? | 輸入檔案[1] | ? | ? | ? | N/A | ? | -i file | N/A | file | ? | -f file | -init file | ? |
| ? | 輸出到檔案而不是 stdout[2] | ? | ? | ? | N/A | ? | -o file | N/A | ? | ? | -o file | N/A | ? |
| ? | 也將輸出複製到檔案 | ? | ? | ? | N/A | ? | N/A | --tee=file | ? | ? | -L file | N/A | ? |