Ruby on Rails @wiki
SQLite3
最終更新:
rubyonrails
-
view
SQLite3
データベース
起動(コマンドプロンプト)
>sqlite3 データベース名
データベース(xxx.sqlite)があればログインし、なければ作成します。
ヘルプの表示
sqlite>.help
環境情報の取得
sqlite> .show
echo | : off | ||
explain | : off | ||
headers | : on | >.headers on で変更できる(SELECT文時に、結果にヘッダーがつく) | |
mode | : column | >.mode column で変更できる(SELECT文時に、結果がカラム毎の幅で整形される) | |
nullvalue | : "" | ||
output | : stdout | 出力場所。ファイル名にすればファイルに出力。stdout は画面のこと | |
separator | : "|" | ||
width | : |
テーブル
テーブル一覧
sqlite>.tables
SELECT文
行数指定
sqlite>SELECT カラム名, ... FROM テーブル名 LIMIT 行数;
外部ファイルからの SQL 実行
sqlite>.read ファイル名
*
sqlite>
*
sqlite>
*
sqlite>
*
sqlite>
*
sqlite>
*
sqlite>
*
sqlite>
*
sqlite>
*
sqlite>
*
sqlite>
*
sqlite>
*
sqlite>