SQLite基本操作,sqlite操作

來源:互聯網
上載者:User

SQLite基本操作,sqlite操作
SQLite基本操作        SQLite的基本操作:建庫、建表、插入資料、修改資料、刪除資料、刪除表、刪除庫。1、建庫在命令列下輸入>sqlite3 test.db                              //注意當前是什麼使用者如果是root使用者則該庫建立在/home目錄下,其他使用者庫建立在使用者的根目錄下sqlite>.database   顯示建立的資料庫2、建表>sqlite3 test.dbsqlite>create table infor(name varchar(10),age int);3、插入資料sqlite>insert into infor values('liu',23);sqlite>insert into infor values('zhang',22);sqlite>insert into infor values('li',24);查看記錄sqlite>select * from infor liu | 23zhang | 22li | 244、刪除資料sqlite>delete from infor where name like 'li';sqlite>select * from infro;liu | 23zhang | 225、更新資料sqlite> update infor set age=20 where name = 'zhang';sqlite>select * from infor;liu | 23zhang | 206、查看錶和庫的資訊sqlite>.tablesinforsqlite>.database0 main /home/sqlite/test.db1temp7、刪除表sqlite>drop table infor;sqlite>.tablessqlite>8、刪除庫>rm test.db


相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.