10 .SQL——查,改,删 的应用练习

create table manage.minageList
  (
      id     int         null comment '编号',
      email  varchar(60) null comment '邮箱地址',
      status int         null comment '邮箱确认状态,是否确认,0是未确认,1就是确认',
      code   varchar(10) null comment '邮箱确认的验证码'
  )


insert into minagelist values (1,"[email protected]" , 1,"TRBXPO ");
insert into minagelist values (2,"[email protected]" , 0,"LOICP ");
insert into minagelist values (3,"[email protected]" , 1,"Lwdada ");
insert into minagelist values (4,"[email protected]" , 1,"Lcsa ");
insert into minagelist values (5,"[email protected]" , 0,"LOsa ");
insert into minagelist values (5,"[email protected]" , 0,"LOsa ");
insert into minagelist values (5,"[email protected]" , 1,"LOsa ");
insert into minagelist values (5,"[email protected]" , 0,"LOsa ");


select * from minagelist;           -- 查询当前表
select * from minagelist where status = 1;  -- 查询status 为1的元组
update  minagelist set code="www"  where id=5;  -- 更改ID为5的元组中的code的信息
select * from minagelist where id = 5;  -- 查询 ID为5的元组
delete from minagelist where status=0;  -- 删除 status 为0的元组
select * from minagelist;

你可能感兴趣的:(java,数据库,sql)