
- SQLite 教程
- SQLite - 首頁
- SQLite - 概述
- SQLite - 安裝
- SQLite - 命令
- SQLite - 語法
- SQLite - 資料型別
- SQLite - 建立資料庫
- SQLite - 附加資料庫
- SQLite - 分離資料庫
- SQLite - 建立表
- SQLite - 刪除表
- SQLite - INSERT 查詢
- SQLite - SELECT 查詢
- SQLite - 運算子
- SQLite - 表示式
- SQLite - WHERE 子句
- SQLite - AND & OR 子句
- SQLite - UPDATE 查詢
- SQLite - DELETE 查詢
- SQLite - LIKE 子句
- SQLite - GLOB 子句
- SQLite - LIMIT 子句
- SQLite - ORDER By 子句
- SQLite - GROUP By 子句
- SQLite - HAVING 子句
- SQLite - DISTINCT 關鍵字
- 高階 SQLite
- SQLite - PRAGMA
- SQLite - 約束
- SQLite - 連線
- SQLite - UNIONS 子句
- SQLite - NULL 值
- SQLite - 別名語法
- SQLite - 觸發器
- SQLite - 索引
- SQLite - INDEXED By 子句
- SQLite - ALTER 命令
- SQLite - TRUNCATE 命令
- SQLite - 檢視
- SQLite - 事務
- SQLite - 子查詢
- SQLite - AUTOINCREMENT
- SQLite - 注入
- SQLite - EXPLAIN
- SQLite - VACUUM
- SQLite - 日期和時間
- SQLite - 有用函式
- SQLite 有用資源
- SQLite - 快速指南
- SQLite - 有用資源
- SQLite - 討論
SQLite - 安裝
SQLite 以其出色的零配置功能而聞名,這意味著無需複雜的設定或管理。本章將引導您完成在 Windows、Linux 和 Mac OS X 上設定 SQLite 的過程。
在 Windows 上安裝 SQLite
步驟 1 - 訪問 SQLite 下載頁面,並從 Windows 部分下載預編譯的二進位制檔案。
步驟 2 - 下載 sqlite-shell-win32-*.zip 和 sqlite-dll-win32-*.zip 壓縮檔案。
步驟 3 - 建立一個資料夾 C:\>sqlite 並將上述兩個壓縮檔案解壓縮到此資料夾中,這將為您提供 sqlite3.def、sqlite3.dll 和 sqlite3.exe 檔案。
步驟 4 - 將 C:\>sqlite 新增到您的 PATH 環境變數中,最後轉到命令提示符併發出 sqlite3 命令,這應該會顯示以下結果。
C:\>sqlite3 SQLite version 3.7.15.2 2013-01-09 11:53:05 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite>
在 Linux 上安裝 SQLite
如今,幾乎所有 Linux 作業系統版本都自帶 SQLite。因此,您只需發出以下命令即可檢查您的機器上是否已安裝 SQLite。
$sqlite3 SQLite version 3.7.15.2 2013-01-09 11:53:05 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite>
如果您沒有看到上述結果,則表示您的 Linux 機器上沒有安裝 SQLite。以下是安裝 SQLite 的步驟:
步驟 1 - 訪問 SQLite 下載頁面,並從原始碼部分下載 sqlite-autoconf-*.tar.gz。
步驟 2 - 執行以下命令:
$tar xvfz sqlite-autoconf-3071502.tar.gz $cd sqlite-autoconf-3071502 $./configure --prefix=/usr/local $make $make install
以上命令將結束在您的 Linux 機器上安裝 SQLite。您可以按照上述說明進行驗證。
在 Mac OS X 上安裝 SQLite
雖然最新版本的 Mac OS X 預裝了 SQLite,但如果您沒有安裝可用,只需按照以下步驟操作:
步驟 1 - 訪問 SQLite 下載頁面,並從原始碼部分下載 sqlite-autoconf-*.tar.gz。
步驟 2 - 執行以下命令:
$tar xvfz sqlite-autoconf-3071502.tar.gz $cd sqlite-autoconf-3071502 $./configure --prefix=/usr/local $make $make install
上述過程將結束在您的 Mac OS X 機器上安裝 SQLite。您可以透過發出以下命令進行驗證:
$sqlite3 SQLite version 3.7.15.2 2013-01-09 11:53:05 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite>
最後,您擁有了 SQLite 命令提示符,您可以在其中為您的練習發出 SQLite 命令。