mysql作业四

我用的是Mysql图形界面化工具是DataGrip,首先我直接新建了一个数据库,然后再用sql语句创建customers表和其中的字段,具体操作如下:
1.根据要求,c_num不能为空且是主键并且自增
c_birth也不能为空
在这里插入图片描述
2.将c_contact字段插入c_birth字段后面:

alter table customers_info add c_contact varchar(50) after c_birth;

3.将c_name字段数据类型改为VARCHAR(70):

alter table customers modify c_name varchar(70);

4.将c_contact字段改名为c_phone:

alter table customers change c_contact c_phone varchar(50);

5.增加c_gender字段,数据类型为CHAR(1):

alter table customers add c_gender char(1);

6.将表名修改为customers_info:

alter table customers rename to customers_info;

7.删除字段c_city:

alter table customers_info drop c_city;

8.修改数据表的存储引擎:

alter table customers_info engine = MyISAM;

9.在Market中创建数据表orders:

CREATE TABLE `orders` (
  `o_date` date DEFAULT NULL,
  `o_id` int(11) DEFAULT NULL,
  `o_num` int(11) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`o_num`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值