mysql学习-入门表格创建,删除,修…

创建表格例子:
  create table item(
    id int auto_increment primary key,
    name varchar(14) not null,
    categoryone varchar(30) not null,
    categorytwo varchar(30) not null,
    price float not null
      );
删除表格:
drop table item;

修改比较多:
添加一列:
alter table item add column item_info text not null add primary key(item_info,id) (添加主键) after price;(跟在price列后面)
还有before和after相反

修改列名称(price变为rmb):
alter table item
change column price rmb float not null;

修改数据类型:
alter table item
modify column price int;

删除列:
alter table item
drop column id;

对table重命名:
alter table item
rename to items;


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值