當前位置:首頁 » 數據倉庫 » 學生選課資料庫表設計
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

學生選課資料庫表設計

發布時間: 2022-07-03 14:00:16

A. Oracle創建學生選課資料庫。完成下列要求:

學生表 student

課程表 course

學生選課關系表 stucourse

  1. create table student(sno number primary key,sname varchar2(20));

    insert into student values(1,'alley');

    insert into student values(2,'bob');

    commit;

create table course(cno number primary key,cname varchar2(20));

insert into course values(1,'語文');

insert into course values(2,'數學');

commit;

create table stucourse(sno number,cno number);

alter table stucourse add constraint pk_stucource primary key(sno,cno);

insert into stucourse values(1,1);

insert into stucourse values(1,2);

insert into stucourse values(2,1);

commit;

2. select a.sname,c.cname

from student a,stucourse b,coursec

where a.sno = b.sno and b.cno=c.no;

3. 查詢選修一門以上的學生,按學號從小到大排序

select a.sno, a.sname

from student a,stucourse b,course c

where a.sno = b.sno and b.cno=c.no

group by a.sno,a.sname

having count(1)>=1

order by a.sno;

4、各用一條語句實現下列功能:添加表的列、更新表的某一欄位值、刪除表的列、刪除表數據、修改表的名稱。

alter table student add ssex varchar2(2);

update student set ssex='女';

alter table student drop column ssex;

delete from student where sno=1;

alter table student rename to studentnew;


5、在PL/SQL中執行SELECT語句:在某一實體表中,查詢符合某一條件的記錄,並顯示相應的幾個欄位值

select sno, sname

from student

where sno=1;


6、用CASE語句實現一多分支結構

select case when sno=1 then '學號1『 when sno=2 then '學號2' else '其他學號' end

from student;

B. 求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條件)

C. 按下列要求創建「學生選課資料庫XX」資料庫(XX為學生的學號),並為資料庫創建三個基本表結構

(1)、select 學號,姓名,年齡 from Student order by 年齡 desc
(2)、select (select 課程名 from Course c where c.課程號=s.課程號) 課程名稱, s.分數 from sc s
where s.學號=(select st.學號 from Student where 姓名='張三')
(3)、select 姓名 from Student where 學號 in ( select distinct 學號 from SC where 分數>=60 )
(4)、select Avg(年齡) from Student st where st.學號 in( select sc.學號 from sc sc where sc.課程號 in (select 課程號 from Course c where 課程名='101'))
and 性別='女'
(5)、select (select 姓名 from Student st where st.學號=sc1.學號) 學生姓名,sc1.分數 from SC sc1
where sc1.分數 in (select max(分數) from sc sc where sc.課程號 in (select 課程號 from Course c where c. 任課老師='張青'))
and sc.課程號 in (select 課程號 from Course c where c. 任課老師='張青')
(6)delete from SC s where s.分數<60
(7)update SC set 分數=avg(select 分數 from sc where 課程號='203') where 學號='105' and 課程號='203'
(8)create view over80 as
select sc1.學號,(select 姓名 from Student st where st. 學號=sc1.學號) 姓名,
sc1.課程號,(select 課程名 from Course c where c. 課程號=sc1.課程號) 課程名,(select 任課老師 from Course c where c. 課程號=sc1.課程號) 任課老師,
sc1.分數
from sc sc1 where sc1.分數>80

D. 做一個學生選課系統;但是資料庫不知道怎麼設計表;請幫忙看看!

第一種方法:設計2個表,一個學生信息表,一個選課記錄表。關聯學生ID.
選課記錄
ID KCname XSID KCbs (主鍵ID)
序號 課程名稱 選課學生身份證 課程標示(1,2,3)
也可以直接用漢字。查詢應該會吧。
學生信息表
XSname XSID tel sex ( 主鍵XSID)
學生名稱 學生身份證 電話 性別

第二種方法:用一張表
ID XSname XSID tel sex KCname KCbs (主鍵ID)
序號 學生名字 學生身份證 電話 性別 課程名字 課程標示

E. 學生選課系統資料庫表設計

超鏈接不一樣嗎

F. 學生選課系統的資料庫設計

先理清楚項目中有多少關聯元素,再理清楚各元素的屬性,最後才是規劃資料庫表
比如,你給出的情況下有以下這些元素:
學生
課程
教室
教師

學生有如下子元素:
基本情況
選修課程記錄

學生-基本情況有如下屬性:
學號,姓名,性別,民族,......

G. 1.設計一個選課資料庫 CMS,並在MySQL中實現

學生表student:id,name (學生id和學生姓名)科目表courses:id,name (科目id和科目名稱)選科表:sid,cid,result (學生id,科目id,成績)例如:student1,張三2,李四courses1,語文2,數學3,英語1,1,901,2,802,1,882,2,902,3,85張三選了語文和數學,李四選了語文數學英語,假如一個學生沒有選課,那麼他不會出現在成績表中(成績可以為空,不一定現在就有成績)