I want to create a table in a SQLite database only if doesn't exist already. Is there any way to do this? I don't want to drop the table if it exists, only create it if it doesn't.
![Create table in SQLite only if it doesn't exist already](https://cdn-ak-scissors.b.st-hatena.com/image/square/98d6f053a97a87156775f60757c60865d0f2c47d/height=288;version=1;width=512/https%3A%2F%2Fcdn.sstatic.net%2FSites%2Fstackoverflow%2FImg%2Fapple-touch-icon%402.png%3Fv%3D73d79a89bded)
.mode コマンドを実行することで、SELECT 文などを実行した結果の表示モードを変更することができます。ここでは SQLite における.mode コマンドの使い方について解説します。
### シェルからコマンドの実行 $ sqlite3 data.db ".tables" auth_group auth_user_groups auth_group_permissions auth_user_user_permissions auth_message django_content_type auth_permission django_session auth_user django_site-- ロードしたDBファイル sqlite> .databases seq name file --- --------------- ---------------------------------------------------------- 0 main /home/roka/Dev/Django/tests/data.db -- テーブル一覧の表示 sqlite> .
カテゴリー AFV(6) 飛行機(6) 山行部通信(6) 1/700長門1927(2) 日記(93) 銀河英雄伝説(29) 地球防衛軍(3) 宇宙世紀(7) 1/700ストラスブール(5) 1/700三景艦(11) 1/700コンテディカブール(10) 1/700ウエストヴァージニア(4) 1/700フォンデアタン(14) 1/700クイーンメリー(8) 1/700パリ(9) 1/700扶桑(11) 1/700アリゾナ(20) 1/700 竣工済み艦船(7) ミニスケールAFV(27) 模型(38) 鉄道(2) 洋書(38) 切手(2) 調理部通信(7) 飼育部だより(12) 和書(10) 資格(37) ゲーム(7) PCメモ(16) 1/700ノースカロライナ(2) 1/700アドミラル・グラーフ・シュペー(1) Ruby on Railsが2.0になってdefaultのDBがsqlit
Pythonをビルド - 檜山正幸のキマイラ飼育記 メモ編の方法でビルドすると、SQLite3が使えない。 $ python Python 2.6.4 (r264:75706, Jan 21 2010, 23:22:41) [GCC 3.4.6 20060404 (Red Hat 3.4.6-10)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sqlite3 Traceback (most recent call last): File "", line 1, in File "/usr/local/python/lib/python2.6/sqlite3/__init__.py", line 24, in from dbapi2 import *
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く