学习笔记(01):MySQL数据库从入门到实战应用-数据完整性

立即学习:https://edu.csdn.net/course/play/27328/362521?utm_source=blogtoedu

sex char(1)‘男’‘女’

alter table contacts add sex char(1)

alter table contacts modify sex int;

alter table contacts drop column sex;

create table contacts(
    id int not null auto_increment primary key,
    name varchar(50),
    sex tinyint default 1,
    phone varchar(20)
);

insert into contacts(name, sex, phone) values ('张三', 1 , '13956452855');

insert into contacts(name, sex, phone) values ('Tom\'s cat', 1 , '13956456655');
insert into contacts(name, sex, phone) values ("Lily's cat", 1 , '13956456656');

insert into contacts(name, sex, phone) values ('李四', 1 , '1390000001'),('王五', 1 ,'1390000002');

update contacts set sex=2;
update contacts set sex=1;

update contacts set sex=2 where id =3 ;

update contacts set sex=2, phone='18900001111'  where id =5;

delete from contacts where id = 4;
delete from contacts;


insert into person(name,id_number) value('张三','654312199012301065');
insert into person(name,id_number) value('张2','654312199012301065');

insert into stu(stu_no,stu_name) values('201901','张三'),('201902','李四');


insert into sc(stu_no, course,grade) values('201901','计算机',100),('201902','计算机',59);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值