MySQL数据库(增删查改)

创建一个表:
create table user(
uid varchar(10) ,
pwd int(10)
);
学生表:
create table student(
sno varchar(20) not null primary key comment '学号' ,
sname varchar(20) not null comment '学生姓名' ,
ssex varchar(20) not null comment '学生性别' ,
sbirthday datetime comment '学生出生年月' ,
class varchar(20) comment '学生所在班级'

);
课程表:
create table course(
con varchar(20) not null primary key comment '课程号' ,
cname varchar(20) not null comment '课程名称' ,
ton varchar(20) not null comment '教工编号'

);
成绩表:
create table score(
id int primary key auto_increment,
sno varchar(20) not null comment '学号' ,
con varchar(20) not null comment '课程号' ,
degree decimal(4,1) not null comment '成绩'

);
教师表:
create table teacher(
tno varchar(20) not null primary key comment '教工编号',
tname varchar(20) not null comment '教工姓名',
tsex varchar(20) not null comment '教工性别' ,
tbirthday datetime comment '教工出生年月' ,
prof varchar(20) comment '职称',
depart varchar(20) not null comment '教工所在部门'
);

插入数据:
use z_0705;
set names gbk;
insert into students1 values
('108','曾华','男','1977-09-01','95033'),
('105','匡明','男','1975-10-02','95031'),
('107','王丽','女','1976-01-23','95033'),
('101','李军','男','1976-02-20','95033'),
('109','王芳','女','1975-02-10','95031'),
('103','陆君','男','1974-06-03','95031');

desc students1 查看表结构
select * from students1 查看表里的数据
show create table students1:查看表的具体信息

drop databases 数据库名;

drop table 表名;

use 数据库名 ;进入数据库

原文地址:https://www.cnblogs.com/awdsjk/p/9481255.html