A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

小新2

初级黑马

  • 黑马币:

  • 帖子:

  • 精华:

© 小新2 初级黑马   /  2018-3-15 20:10  /  1343 人查看  /  2 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

1创建表
create table 表名(字段名 类型 约束,字段名 类型 约束...)

例:创建学生表,字段要求如下:
姓名(长度为10), 年龄
create table students(name varchar(10),age int unsigned)

2删除表
格式一:drop table 表名
格式二:drop table if exists 表名

例:删除学生表
drop table students或drop table if exists students

3简单查询
select * from 表名
例:查询所有学生数据
select * from students

4添加数据
例:插入一个学生,设置所有字段的信息
insert into students values(0,'亚瑟',22,177.56)

5修改
例:修改id为5的学生数据,姓名改为 狄仁杰,年龄改为 20
update students set name='狄仁杰',age=20 where id=5

2 个回复

倒序浏览
赞一个
回复 使用道具 举报

赞一个sadas;ldj;adsjsa;fjas;
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马