数据库

2018-04-02  本文已影响6人  huicuihui

//创建表的SQL语句 primary key:主键,区分每一条数据因此开发中主键的值不能够相同。autoincrement:自增,修饰的属性在每一次增加数据的时候值都会自动加1。

create table if not exists Students(stu_id integer primary key autoincrement, stu_name text, stu_gender text, stu_age integer)

//插入一条数据

insert into Students(stu_name, stu_gender, stu_age)values('哇哈哈','男',23)

//更新某一条指定的数据

update Students set stu_name = '田志超', stu_age = 25 where stu_id = 7

//查询多有数据(属性)

select * from Students

“ * " 代表所有属性列的内容,如果其中一部分的话需要特别指明 如下的这句

select stu_name,stu_gender from Students

//查询指定的某一条数据

select * from Students where stu_id = 1

//where是条件,可以改。 删除一条数据

delete from Students where stu_id = 3
delete from Students where stu_id = 5 and stu_id = 18

//删除整个表

drop Table Students
drop Database Students//删除数据库
上一篇下一篇

猜你喜欢

热点阅读