日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Linux下安裝和使用SQLite3

SQLite3是一種嵌入式數(shù)據(jù)庫,它的數(shù)據(jù)庫就是一個文件。由于SQLite3本身是C寫的,而且體積很小,所以,經(jīng)常被集成到各種應(yīng)用程序中,甚至在iOS和Android的App中都可以集成。

成都創(chuàng)新互聯(lián)公司長期為上1000+客戶提供的網(wǎng)站建設(shè)服務(wù),團(tuán)隊(duì)從業(yè)經(jīng)驗(yàn)10年,關(guān)注不同地域、不同群體,并針對不同對象提供差異化的產(chǎn)品和服務(wù);打造開放共贏平臺,與合作伙伴共同營造健康的互聯(lián)網(wǎng)生態(tài)環(huán)境。為仁和企業(yè)提供專業(yè)的成都網(wǎng)站設(shè)計(jì)、成都做網(wǎng)站、外貿(mào)網(wǎng)站建設(shè),仁和網(wǎng)站改版等技術(shù)服務(wù)。擁有10年豐富建站經(jīng)驗(yàn)和眾多成功案例,為您定制開發(fā)。

一 。linux 下安裝數(shù)據(jù)庫和創(chuàng)建一個數(shù)據(jù)庫

\1. Linux 下安裝sqlite3 需要兩個命令 即可

(1) sudo apt-get install sqlite

(2) sudo apt-get install libsqlite3-dev

\2. 安裝完后,創(chuàng)建一個數(shù)據(jù)庫,終端下輸入命令 【sqlite3 數(shù)據(jù)庫名字 】數(shù)據(jù)庫名字以 .db 結(jié)尾格式

創(chuàng)建數(shù)據(jù)庫student.db 【 sqlite3 student.db

二 。數(shù)據(jù)庫命令是以 【.】 開頭的;數(shù)據(jù)庫語句是以【;】結(jié)尾的

\1. 數(shù)據(jù)庫命令

(1) .schema 表名 顯示表結(jié)構(gòu) 如:【 .schema student

(2)【 .tables 】 顯示表

(3)【 .quit 】或 【 .exit 】 退出數(shù)據(jù)庫控制界面

\2. 數(shù)據(jù)庫語句

(1)創(chuàng)建一個數(shù)據(jù)表:student 【 create table student (id int primary key,name char,age int,sex char);

(2)向表中插入數(shù)據(jù) insert into 表名 values (值1,值2,值3,值4); 如:【 insert into student values (0,’zhang0′,20,’m’); 】 沒有返回錯誤信息則插入成功


(3)查找語句 select *from 表名;

查找表中所有內(nèi)容顯示 【 select *from student;

查找某個字段(列信息)【 select id from student;

按照某個條件查找 【 select * from student where age>25 and sex=’m’ 】 { 條件 and or 表示 與 ,或 }

(4)修改某個內(nèi)容 update 表名 set 列名=新值 where 條件; 如:把 zhang0 的名字改為 liwang 【update student set name=‘liwang’ where name=’zhang0‘;

(4)刪除一條信息 :delete from 表名 where 條件; 如:刪除名字為hello的一行內(nèi)容 【 delete from student where name=’hello’;

(5)添加一列 : alter table 表名 add 列名 數(shù)據(jù)類型; 【alter table student add address char;

img

update student set address=’beijing’;】 把地址字段全部更新為beijing

(5)刪除一個表 drop table 表名; 【 drop table soc;

(6)sqlite3不支持刪除一列信息,可以 把原來的表里面的需要的列復(fù)制到一個新表,重新命名:create table 新表名 as select 列名1,列名2,列名3,列名4 from 舊表名;

create table stu as select id,name,sex from student; 】 選擇student表中的id,name,sex字段作為新表的字段

(7)重新命名表 :alter table 舊表名 rename to 新表名; 【 alter table stu rename to student_new;

(8)select count(*) from sqlite_master where *type=”table” and name = “表名”;*

注意:表示字符串可以是””或者”SQL語句結(jié)束必須是一個分號。


網(wǎng)頁名稱:Linux下安裝和使用SQLite3
轉(zhuǎn)載注明:http://www.5511xx.com/article/cdiihpj.html