Sqlite3 領卓教育

2021-08-29 20:33:53 字數 608 閱讀 6579

1.安裝資料庫:sudo apt-get install sqlite3

2.執行資料庫:sqlite3

3.退出資料庫: .exit

4.開啟資料庫檔案:sqlite3 xx.db

(若存在,則開啟。不存在,則建立再開啟)

5.顯示當前開啟 的資料庫檔案: .database

6.在資料庫中建立乙個表 :create table (f1 type1,f2 type2,……);

7.檢視乙個表 : .tables :檢視資料庫中建立的表

.schema :詳細的檢視表中的結構

8.刪除乙個表: drop table

9.向表中插入記錄:insert into values(valiu1,value2,……);

10.在資料庫中查詢記錄:

select *from ; (查詢表中的所有資訊)

select *from where ;(精確查詢)

11. 刪除乙個記錄:delete from where ;

12. 修改乙個記錄:update set ,……where ;

13. 在表中新增字段(列):

alter table add column ;

使用sqlite3 模組操作sqlite3資料庫

python內建了sqlite3模組,可以操作流行的嵌入式資料庫sqlite3。如果看了我前面的使用 pymysql 操作mysql資料庫這篇文章就更簡單了。因為它們都遵循pep 249,所以操作方法幾乎相同。廢話就不多說了,直接看 吧。都差不多,首先匯入模組,然後建立連線,然後獲取游標物件,之後利...

領卓教育 隨機點名程式

簡單的隨機點名系統,利用c語言編寫 如下 include include char name int main printf n return 0 首先定義陣列,陣列內的成員是即將隨機的名字,本程式以作者班級同學為例 include 是linux下時間和日期的標頭檔案 gettimeofday是獲得...

領卓教育 字元裝置實現流程

如何一步一步執行驅動 在進行驅動載入的過程中使用 insmod hello.ko時,會執行驅動的載入函式,module init hello init hello init 在驅動的載入函式中會進行裝置的註冊 1.mkdev hello major,hello minor 去生成裝置號 2.向核心去...