SQLite でテーブル定義
このページでは SQLite を使い、次のテーブルを定義する.データベース名は my.dbとしている.
- Point3 (x, y, z)
- Point3Color (x, y, z, r, g, b, a)
- Point3Normal(x, y, z, nx, ny, nz);
- Polygon3(id, nx, ny, nz)
- Point3Polygon3 (point3, polygon3)
前準備
前もって,SQLite をインストールしておくこと.
SQLite でテーブル定義
- SQLite を実行する.
* パスが通っていないときは,パスを通すか,フルパスで実行する
sqlite3
- 空のデータベースを新規作成
.open --new my.db .exit
- テーブルを定義したいので,次の SQL プログラムを実行.
* 「.exit」で終了する
/* 3-dimensional Graphcs */ create table Point3 ( x real not null, y real not null, z real not null ); create table Point3Color ( x real not null, y real not null, z real not null, r integer, g integer, b integer, a integer ); create table Point3Normal ( x real not null, y real not null, z real not null, nx real, ny real, nz real ); create table Polygon3 ( id integer primary key not null, nx real, ny real, nz real ); create table Point3Polygon3 ( point3 integer not null, polygon3 integer not null );