对数据库的表进行操作(表=对象)【DDL】
一、
-- 查看数据:
select * from t_student;
-- 修改表的结构:
-- 增加一列:
alter table t_student add score double(5,2); -- 5:总位数; 2:小数位数
update t_student set score =123.4567 where sno =1; -- 四舍五入
-- 增加一列(放在最前面)
alter table t_student add score double(5,2) first;
--增加一列(放在sex后面)
alter table t_student add score double(5,2) after sex;
-- 删除一列
alter table t_student drop score;
-- 修改一列:
alter table t_student modify score float(4,1); -- modify修改的是列的类型的定义,但不会改变列的名字
alter table t_student change score score1 double(4,1); -- change修改列名和列的类型定义
--删除表:
drop table t_student;