创建一个表:create table if not exists Teachaers(tea_id integer primary key autoincrement,tea_name text,tea_gender text,tea_age interger,tea_salary text)
primary key 主键
create table if not exists Teachaers(tea_id integer primary key autoincrement,tea_name text,tea_gender text,tea_age interger,tea_salary text)primary key 主键 区分每一条数据,因此在开发中主键的值是唯一的,不允许有相同的两个值存在. autoincrement自增 修饰的属性值在每一次数据增加时值就会自动增加一.
插入数据:insert into Teachaers(tea_name ,tea_gender,tea_age,tea_salary)values("xx","x",20,xxxx)
查询数据
查询所有的数据:select * from Teachaers
查询某一条数据:select * from Teachaers where tea_id = 2
查询多个条件的数据:select * from Teachaers where tea_gender = "女" and tea_age = 25
查询部分数据:select tea_name ,tea_salary from Teachaers where tea_id = 2
删除表中某一个元素:delete from Teachaers where tea_id = 2
更新数据库某一条的某一个部分
update Teachaers set tea_name = "蔡cai" ,tea_age =27 where tea_salary = 130000
删除表格
drop table 表名