求Oracle设计的学生选课管理系统的数据库(包含SQL语句)

求一个用Oracle设计的学生选课管理系统的数据库,其中包含有SQL语句?

我理解楼主是要一个数据库的设计方案,其中包括相关SQL、逻辑关系、业务处理方法。
(Ps:偶平时工作就是做设计和开发的,以下所有SQL经过oracle测试)
学生表 Student:
学生ID(主键)、学生代码、学生名称、备用字段1、备用字段2、备用字段3;
课程表 Class:
课程ID(主键)、课程代码、课程名称、备用字段1、备用字段2、备用字段3;
MAPPING表 StuClass:
主键ID、学生ID、课程ID。
-- Create table student
create table student
(
studentid number(22),
studentcode varchar2(16),
studentname varchar2(16),
attr1 varchar2(64),
attr2 varchar2(64),
attr3 varchar2(64)
);
-- Create primary key constraints
alter table student
add constraint student_pk primary key (STUDENTID);

-- Create table class
create table class
(
classid number(22),
classcode varchar2(16),
classname varchar2(16),
attr1 varchar2(64),
attr2 varchar2(64),
attr3 varchar2(64)
);
-- Create primary key constraints
alter table class
add constraint class_pk primary key (CLASSID);

-- Create table stuclass
create table stuclass
(
stuclassid number(22),
studentid varchar2(16),
classid varchar2(16)
);
-- Create primary key constraints
alter table stuclass
add constraint stuclass_pk primary key (STUCLASSID);

系统初始化时录入主数据:学生信息、课程信息。
APP做业务处理:
1、学生选课程(单选或多选):insert into stuclass values(?,?,?);
2、查看所有学生选择的所有课程:
select s.studentcode,s.studentname,c.classcode,c.classname
from student s left join stuclass sc on s.studentid=sc.studentid
left join class c on sc.classid=c.classid order by s.studentid
(如查看某些学生或某个学生选择了哪些课程,可在后面加where条件)
3、查看所有课程有哪些学生选择:
select c.classcode,c.classname,s.studentcode,s.studentname
from class c left join stuclass sc on sc.classid=c.classid
left join student s on s.studentid=sc.studentid order by c.classid
(如查查看某些课程或某个课程有哪些学生选择,可在后面加where条件)
温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-12-19
Connection Conn=null;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String strConn="jdbc:odbc:studentData";
String strUser="sa";
String strPassword="";
Conn=DriverManager.getConnection(strConn,strUser,strPassword);
Statement stmt=Conn.createStatement();
String strSql="SELECT name,nation,sex,born,political,address,s_id,birthplace,speciality,class,registration From studentinf";
ResultSet rs=stmt.executeQuery(strSql);
%>
<table width="742" height="390" border="1">
<tr>
<td colspan="4" scope="row"><div align="center" class="STYLE4">学生基本信息</div></td>
<td width="179" colspan="2" rowspan="6"><div align="center">照片</div></td>
第2个回答  2013-12-19
datebase = new datebase;
第3个回答  2013-12-19
马子~
相似回答