sqlite3資料庫新增欄位及相應設定

2021-08-21 04:06:58 字數 270 閱讀 6411

sqlite3資料庫對於欄位的操作僅限於增加字段,如果想要刪除欄位或修改欄位名則需要用拷貝整個頁表的形式(sqlite3沒有提供直接修改刪除欄位的功能)

alter table list add new2column text default 'nihao'not null

這句是在list表中增加乙個名字叫new2column 的資料型別為text 的字段(列),該欄位存有預設值'nihao',且不為空.

alter table list add new2column text

Sqlite3 資料庫使用

iphone本身是支援 sqlite3 資料庫的,在專案中匯入libsqlite3.dylib。並建立資料庫,在終端,建立資料庫的方式 mkdir sql 建立sql資料夾 cd sql 進入sql目錄下 sqlite3 student.sql 建立名為 student.sql的資料庫 建立表 插入...

sqlite3資料庫操作

1 開啟資料庫 1 需要制定資料庫的路徑 nsstring filepath nshomedirectory documents data.sqlite 2 建立資料庫的物件 sqlite3 qingyundb null 3 開啟命令 sqlite3 open dbfilepath utf8stri...

SQLite3資料庫操作

簡單的sqlite3語句,通過字串拼接執行資料庫操作。1.建立資料庫格式 db.execsql create table if not exists sharp id integer primary key,name varchar,level integer,high integer 其真正的有效...