//首先新建一个stu表,并添加相应的字段约束;
--创建学生表;
create table stu(
id number(20),
name varchar2(10),
sex char(2),
age number(10),
score number(10),
password number(10)
);
--给学生表字段添加约束;
--id 添加主键
alter table stu add primary key (id);
--name 不能为空
alter table stu modify name not null;
--性别为男或女
alter table stu add check(sex='男' or sex='女');
--年龄大于0
alter table stu add check(age>0);
--分数是0-100之间
alter table stu add check(score>=0 and score<=100);
--密码不能为空
alter table stu modify password not null;
//之后编写如下学生登录和注册等相应功能;
package jdbc.eduask.homework;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Scanner;
//新建一个学生管理系统类;