--创建数据库

create database ios

--使用数据库

use ios

--创建数据表

create table student

(

    stuid int primary key autoincrement,

    stuname varchar(20),

    stupwd varchar(20)

)

--查询所有信息

select * from student

 

--增加信息

insert into student(stuname,stupwd)

values ('lisi','123456')

--修改

update student set stuname = '李四'

where stuid = 1

update student set stuname = '李四',stupwd='Sd123'

where stuid = 1

--删除

delete from student where stuid=1

 

查询

 1、查询所有信息

 select * from student

 2、查询表中的行数

 select count(*) from student 

 3、降序排列

 select * from student order by stuid desc

 升序排列

 select * from student order by stuid asc

 4、分组

 select count(*)from student group by stuname

posted on 2016-03-22 23:55  pruple_Boy  阅读(151)  评论(0编辑  收藏  举报