160905 常用表操作 1. mysql -u root -p 回车 输入密码 2. 显示数据库列表 show databases 3. 进入某数据库 use database database160904;是错的 use database160904;才是正确的 4. 显示有哪些表 show tables; 5.创建表 create table student3(id int auto_increment primary key, user varchar(30) not
10.8 修改表.复制表.删除表 10.81 修改表 alter table . 修改表名 alter table 表名 rename 新表名; . 增加字段 alter table 表名 add 字段名 数据类型 [完整性约束条件…]; ) not null after name; #添加到name字段之后 alter table t1 add sex enum('male','female') default 'male' first;#添加到最前面 . 删除字段 alter table t
一.单表查询 单表查询的完整语法: .完整语法(语法级别关键字的排列顺序如下) select distinct 字段1,字段2,字段3,... from 库名.表名 where 约束条件 group by 分组依据 having 过滤条件 order by 排序的字段 limit 限制显示的条数 ; 必须要有的关键字如下:select * from t1; 分析之前先将其进行占位,需要什么在进行添加 关键字执行的优先级:fromwheregroup byhavingdistinctorder b
字段的修改.添加和删除 create table tf1( id int primary key auto_increment, x int, y int ); #修改 alter table tf1 modify x char(4) default''; alter table tf1 change y m char(4) default ''; #增加 alter table 表名 add 字段名 类型[(长度) 约束]; >:alter table student add name cha