mysql基础操作

drop database stuDB;

create database stuDB;
use stuDB;

drop table stu_info;
create table stu_info
(
sno int primary key auto_increment,
sname varchar(100) not null,
age int comment '年纪',
sex char(1),
scope float(10,2),
address varchar(100)
)ENGINE=InnoDB DEFAULT CHARSET=gb2312;

alter table stu_info add column
classNo varchar(10);
alter table stu_info add column
birthday date;

insert into stu_info(sname,age,sex,scope,address,birthday)
values('cc',45,'男',56.45,'重庆',now());  --或者'1993-10-29'--

update stu_info set age=20;
update stu_info set scope=80,address='秦皇岛' where sex='男';
delete from stu_info; --清除所有数据--
delete from stu_info where sex='女';

select * from stu_info;

posted @ 2017-06-01 15:14  July落花雨  阅读(66)  评论(0编辑  收藏  举报