您的位置:首页 > 编程语言 > Java开发

Java学生管理系统练习(一) 数据库创建(MySQL)

2019-03-10 21:30 429 查看
版权声明:此为路痴小莫原创,未经允许不得转载。 https://blog.csdn.net/luchixiaomo/article/details/88384257

1.查看已建立的数据库

show databases;

2.建立新数据库

create database stusystem;

3.使用当前数据库创建表

use stusystem;

create table student(
sno varchar(10) primary key,
sname varchar(5)  not null,
gender varchar(2) default '女',
birthday date,
sage int(2) not null
);

4.插入数据

向已建立的学生表中插入学生信息。

insert into student(sno,sname,gender,sage,birthday)values('11011','小李','女','18','2001-05-21');
insert into student(sno,sname,gender,sage,birthday)values('11012','小王','男','19','2000-08-01');
insert into student(sno,sname,gender,sage,birthday)values('11013','小赵','女','19','2000-10-11');
insert into student(sno,sname,gender,sage,birthday)values('11014','小明','男','18','2001-04-16');
insert into student(sno,sname,gender,sage,birthday)values('11015','小丽','女','19','2000-11-14');
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: