This article uses a project to explain the sql statement of creating table with mysql. jsp freshmen check in system to see how to analyze requirements and convert them into database statements.
Pay attention to write notes when creating tables, and form a good habit.
The super administrator table creation statement is as follows:
create table t_admin( id int primary key auto_increment comment 'Primary key', username varchar(100) comment 'Super administrator account', password varchar(100) comment 'Super administrator password' ) comment 'Super administrator'; insert into t_admin(username,password) values('admin','123456');
The class name table creation statement is as follows:
create table t_bj( id int primary key auto_increment comment 'Primary key', bjName varchar(100) comment 'Class name' ) comment 'Class name';
The creation statement of dormitory table is as follows:
create table t_gy( id int primary key auto_increment comment 'Primary key', gyName varchar(100) comment 'dormitory' ) comment 'Dormitory';
The creation statement of payment table is as follows:
create table t_jf( id int primary key auto_increment comment 'Primary key', studentId int comment 'Student', status varchar(100) comment 'Whether to pay', jfDate varchar(100) comment 'Payment date' ) comment 'pay';
The table creation statement is as follows:
create table t_lt( id int primary key auto_increment comment 'Primary key', studentId int comment '', toId int comment '', content varchar(100) comment 'content', only varchar(100) comment '' ) comment '';
The information table creation statement is as follows:
create table t_message( id int primary key auto_increment comment 'Primary key', studentId int comment 'Student', v1 varchar(100) comment 'content', insertDate datetime comment 'date', status varchar(100) comment 'state' ) comment 'information';
The student table creation statement is as follows:
create table t_student( id int primary key auto_increment comment 'Primary key', username varchar(100) comment 'Admission Notice No', password varchar(100) comment 'ID number', studentName varchar(100) comment 'Full name', age varchar(100) comment 'Age', sex varchar(100) comment 'Gender', phone varchar(100) comment 'Telephone', bjId int comment 'class', gyId int comment 'dormitory', ishd varchar(100) comment 'Check the information', iszc varchar(100) comment 'Register or not' ) comment 'Student';
The creation statement of physical examination table is as follows:
create table t_tj( id int primary key auto_increment comment 'Primary key', studentId int comment 'Student', status varchar(100) comment 'Physical examination or not', tjDate varchar(100) comment 'Date of physical examination', tjPic varchar(100) comment 'Physical examination photos' ) comment 'Physical examination';
The statement to create the physical examination registration form is as follows:
create table t_tjbm( id int primary key auto_increment comment 'Primary key', studentId int comment 'Student', v1 varchar(100) comment 'Full name', v2 varchar(100) comment 'Gender', v3 varchar(100) comment 'Department', v4 varchar(100) comment 'Professional class', insertDate datetime comment 'date' ) comment 'Physical examination registration';
How are you? Have you learned?