创建SQL语句_面试

创建一个表: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 表名

上一篇:Rich控件二


下一篇:安装Compass时不能访问服务器的问题