SQLiteman は SQLite データベースを操作する機能を持ったソフトウエア. Windows 版,Linux 版,Max OS X 版があります.ソースコードも配布されている.
【このページの目次】
あとで,ここに データベースファイルを置くことにする.
以下、C:\sqlite3に展開(解凍)したとして説明を続ける
※ Windows での展開(解凍)のためのソフトには,「7-Zip」などがある.
新しい画面が開くので確認する.
以下の手順で,新しいデータベースを作成する.その結果,データベースファイルができる.
ここでの設定
Windows での操作例
※ 以下の例では「C:\sqlite3\mydb」を指定している).
※ データベースファイル名は何でも良いが、英語の名前がよい.
SQL編集画面に,次の SQL を書く
create table order_records (
id integer primary key not null,
year integer not null CHECK ( year > 2008 ),
month integer not null CHECK ( month >= 1 AND month <= 12 ),
day integer not null CHECK ( day >= 1 AND day <= 31 ),
customer_name text not null,
product_name text not null,
unit_price real not null check ( unit_price > 0 ),
qty integer not null default 1 check ( qty > 0 ),
created_at timestamp with time zone not null,
updated_at timestamp with time zone,
check ( ( unit_price * qty ) < 200000 ) );
これで,テーブル定義がうまくいったことを確認.
begin transaction; insert into order_records (id, year, month, day, customer_name, product_name, unit_price, qty) values( 1, 2020, 7, 26, 'kaneko', 'orange A', 1.2, 10 ); insert into order_records (id, year, month, day, customer_name, product_name, unit_price, qty) values( 2, 2020, 7, 26, 'miyamoto', 'Apple M', 2.5, 2 ); insert into order_records (id, year, month, day, customer_name, product_name, unit_price, qty) values( 3, 2020, 7, 27, 'kaneko', 'orange B', 1.2, 8 ); insert into order_records (id, year, month, day, customer_name, product_name, unit_price) values( 4, 2020, 7, 28, 'miyamoto', 'Apple L', 3 ); commit;
select * from order_records;
本サイトは金子邦彦研究室のWebページです.サイトマップは,サイトマップのページをご覧下さい. 本サイト内の検索は,サイト内検索のページをご利用下さい.
問い合わせ先: 金子邦彦(かねこ くにひこ) ![]()