物資管理信息系統1 -- 數據庫設計

一。創建數據庫sql

  1. 登陸信息數據庫 logo.db 建立表[use] (2014-2-23)數據庫

import sqlite
var db = sqlite("/res/logo.db") 
db.exec( "CREATE TABLE IF NOT EXISTS [use](id PRIMARY KEY,用戶名,密碼);" ) 
db.exec("insert into use values('001','admin','admin');" ) 
db.close()

 

id 用戶名 密碼
001 admin admin
002 boy1 123

教材數據庫沒有id字段,但我的認爲仍是加上ID 比較合適並設置爲主鍵。 編碼

2. 物資管理信息數據庫 store.db   
spa

import sqlite
var db = sqlite("/store.db")

2-1 物資信息表Goods 2014-2-28
rest

db.exec( "CREATE TABLE IF NOT EXISTS [Goods](GoodsId PRIMARY KEY,GoodsName,Type,Unit);" )


GoodsId GoodsName Type Unit
1001 鍍鋅管 15

2-2 入庫信息表 inlib code

進庫單號碼 發票號碼 進庫日期 經辦人 保管人
100 100 2000-1-1

2-3 入庫材料信息表 inlibdetailsqlite

CREATE TABLE IF NOT EXISTS [inlibdetail](

進庫單號碼 references [inlib](進庫單號碼) on delete restrict deferrable initially immediate,

材料編碼 references [Goods](材料編碼) on delete restrict deferrable initially deferred,

數量,

單價,

金額,

備註

)
相關文章
相關標籤/搜索