国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

數(shù)據(jù)庫作業(yè)

這篇具有很好參考價(jià)值的文章主要介紹了數(shù)據(jù)庫作業(yè)。希望對大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

目錄

數(shù)據(jù)庫teaching中的表結(jié)構(gòu)和表記錄。

問題:

答案:


數(shù)據(jù)庫teaching中的表結(jié)構(gòu)和表記錄。


  ?。?)學(xué)生信息表student
   #student表結(jié)構(gòu)
     create table if not exists student (
     studentno ?char(11) not null comment'學(xué)號(hào)',?
     sname char(8) not null comment'姓名',?
     sex enum('男', '女') default '男' comment'性別',?
     birthdate date not null comment'出生日期',?
     entrance int(3) ?null comment'入學(xué)成績',?? ??? ??
     phone varchar(12) not null comment'電話',?
     Email varchar(20) not null comment'電子信箱',
     primary key (studentno)
     );
   #student表常用數(shù)據(jù)
     studentno?? ?sname sex?? ?birthdate ? entrance?? ? ?phone?? ? ? ? ?Email
     20112100072?? ?許東方 ?男?? ?2002/2/4?? ? ? ? 658?? ? ?12545678998?? ?su12@163.com?
     20112111208?? ?韓吟秋 ?女?? ?2002/2/14?? ?666?? ? ?15878945612?? ?han@163.com?
     20120203567?? ?封白玫 ?女?? ?2003/9/9?? ? ? ? 898?? ? ?13245674564?? ?feng@126.com
     20120210009?? ?崔舟帆 ?男?? ?2002/11/5?? ?789?? ? ?13623456778?? ?cui@163.com?
     20123567897?? ?趙雨思 ?女?? ?2003/8/4 ?? ?879?? ? ?13175689345 ? ?pinan@163.com
     20125121109?? ?梁一葦 ?女?? ?2002/9/3 ??? ?777?? ? ?13145678921?? ?bing@126.com?
     20126113307?? ?姚扶竹 ?女?? ?2003/9/7 ??? ?787?? ? ?13245678543?? ?zhu@163.com
     21125111109?? ?敬秉辰 ?男?? ?2004/3/1?? ? ? ? 789?? ? ?15678945623 jing@sina.com?
     21125221327?? ?何桐影 ?女?? ?2004/12/4?? ?879?? ? ?13178978999 ?he@sina.com?
     21131133071?? ?崔依歌 ?男?? ?2002/6/6?? ? ? ? 787 ? 15556845645 ?cui@126.com?
     21135222201?? ?夏文斐 ?女?? ?2005/10/6?? ?867?? ? ?15978945645 ?xia@163.com?
     21137221508?? ?趙臨江 ?男?? ?2005/2/13?? ?789?? ? ?12367823453 ?ping@163.com?

數(shù)據(jù)庫作業(yè)


  ?。?)課程信息表course
   #course表結(jié)構(gòu)
     create table if not exists course (
     courseno ?char(6) not null,?
     cname ?char(6) not null,?
     type char(8) not null, ?
     period int(2) not null,?
     exp int(2) not null,
     term int(2) not null,
     primary key (courseno)
     );?
   #course表常用數(shù)據(jù)
     courseno?? ?cname?? ??? ?type ? period ? ?exp?? ?term
     c05103?? ??? ?高等數(shù)學(xué)?? ??? ?必修?? ??? ?64?? ??? ?16?? ? 2
     c05109?? ??? ?C語言?? ??? ?必修?? ??? ?48?? ??? ?16?? ? 2
     c05127?? ??? ?數(shù)據(jù)結(jié)構(gòu)?? ??? ?必修?? ??? ?64?? ??? ?16?? ? 2
     c05138?? ??? ?軟件工程?? ??? ?選修?? ??? ?48?? ??? ?8?? ? 5
     c06108?? ??? ?機(jī)械制圖?? ??? ?必修?? ??? ?60?? ??? ?8?? ? 2
     c06127?? ??? ?機(jī)械設(shè)計(jì)?? ??? ?必修?? ??? ?64?? ??? ?8?? ? 3
     c06172?? ??? ?鑄造工藝?? ??? ?選修?? ??? ?42?? ??? ?16?? ? 6
     c08106?? ??? ?經(jīng)濟(jì)法?? ??? ?必修?? ??? ?48?? ??? ?0?? ? 7
     c08123?? ??? ?金融學(xué)?? ??? ?必修?? ??? ?40?? ??? ?0?? ? 5
     c08171?? ??? ?會(huì)計(jì)軟件?? ??? ?選修?? ??? ?32?? ??? ?8?? ? 8

數(shù)據(jù)庫作業(yè)
  ?。?)成績信息表score
   #score表結(jié)構(gòu)
     create table if not exists score(
     studentno ?char(11) not null,?
     courseno ?char(6) not null,?
     daily float(4,1) default 0,?
     final float(4,1) default 0,
     primary key (studentno , courseno)?
     );?
   #score表常用數(shù)據(jù)
     studentno?? ?courseno ?? ?daily?? ?final
     20112100072?? ?c05103?? ??? ?99 ?? ??? ?92
     20120203567?? ?c05103?? ? ??? ?78?? ??? ?67
     20120210009?? ?c05103?? ??? ?65?? ??? ?98
     20125121109?? ?c05103?? ??? ?88?? ??? ?79
     21125111109?? ?c05103?? ??? ?96?? ??? ?97
     21137221508?? ?c05103?? ??? ?77?? ??? ?92
     20112100072?? ?c05109?? ??? ?95?? ??? ?82
     20120203567?? ?c05109?? ??? ?87?? ??? ?86
     20125121109?? ?c05109?? ??? ?77?? ??? ?82
     20126113307?? ?c05109?? ??? ?89?? ??? ?95
     21125111109?? ?c05109?? ??? ?87?? ??? ?82
     21125221327?? ?c05109?? ??? ?89?? ??? ?95
     20120210009?? ?c05138?? ??? ?88?? ??? ?89
     21137221508?? ?c05138?? ??? ?74?? ??? ?91
     20112111208?? ?c06108?? ??? ?77?? ??? ?82
     20120210009?? ?c06108?? ??? ?79?? ??? ?88
     20123567897?? ?c06108?? ??? ?99?? ??? ?99
     20126113307?? ?c06108?? ??? ?78?? ??? ?67
     20112111208?? ?c06127?? ??? ?85?? ??? ?91
     20120203567?? ?c06127?? ??? ?97?? ??? ?97
     20112111208?? ?c06172?? ??? ?89?? ??? ?95
     21125221327?? ?c06172?? ??? ?88?? ??? ?62
     21131133071?? ?c06172?? ??? ?78?? ??? ?95
     21125111109?? ?c08106?? ??? ?77?? ??? ?91
     21135222201?? ?c08106?? ??? ?91?? ??? ?77
     21137221508?? ?c08106?? ??? ?89?? ??? ?62
     21131133071?? ?c08123?? ??? ?78?? ??? ?89
     21135222201?? ?c08123?? ??? ?79?? ??? ?99
     20112100072?? ?c08171?? ??? ?82?? ??? ?69
     20125121109?? ?c08171?? ??? ?85?? ??? ?91
     21131133071?? ?c08171?? ??? ?88?? ??? ?98
     21135222201?? ?c08171?? ??? ?85?? ??? ?92
     數(shù)據(jù)庫作業(yè)
   (4)教師信息表teacher
   #teacher表結(jié)構(gòu)
     create table if not exists teacher (
     teacherno ?char(6) not null comment '教師編號(hào)',?
     tname ?char(8) not null comment'教師姓名',?
     major ?char(10) not null comment '專業(yè)',?
     prof char(10) not null comment '職稱',
     department char(16) not null comment '部門',
     primary key (teacherno)
     );?
   #teacher表常用數(shù)據(jù)
     teacherno?? ?tname?? ??? ?major?? ??? ?prof ?? ?department
     t05001?? ??? ?蘇超然?? ??? ?軟件工程?? ??? ?教授?? ??? ?計(jì)算機(jī)學(xué)院
     t05002?? ??? ???捎^?? ??? ?會(huì)計(jì)學(xué)?? ??? ?助教?? ??? ?管理學(xué)院
     t05003?? ??? ?孫釋安?? ??? ?網(wǎng)絡(luò)安全?? ??? ?教授?? ??? ?計(jì)算機(jī)學(xué)院
     t05011?? ??? ?盧敖治?? ??? ?軟件工程?? ??? ?副教授?? ?計(jì)算機(jī)學(xué)院
     t05017?? ??? ?茅佳峰?? ??? ?軟件測試?? ??? ?講師?? ??? ?計(jì)算機(jī)學(xué)院
     t06011?? ??? ?夏期年?? ??? ?機(jī)械制造?? ??? ?教授?? ??? ?機(jī)械學(xué)院
     t06023?? ??? ?盧釋舟?? ??? ?鑄造工藝?? ??? ?副教授?? ?機(jī)械學(xué)院
     t07019?? ??? ?韓庭宇?? ??? ?經(jīng)濟(jì)管理?? ??? ?講師?? ??? ?管理學(xué)院
     t08017?? ??? ?白成園?? ??? ?金融管理?? ??? ?副教授?? ?管理學(xué)院
     t08058?? ??? ?孫有存?? ??? ?數(shù)據(jù)科學(xué)?? ??? ?副教授?? ?計(jì)算機(jī)學(xué)院

數(shù)據(jù)庫作業(yè)
  ?。?)紐帶表teach_course
   #teach_course表結(jié)構(gòu)
     create table if not exists teach_course (
     teacherno char(6) not null,?
     courseno ?char(6) not null,?
     primary key (teacherno,courseno)?
     );
   #teach_course表常用數(shù)據(jù)
     teacherno ?courseno
     t05001?? ??? ?c05103
     t05002?? ??? ?c05109
     t05003?? ??? ?c05127
     t05011?? ??? ?c05138
     t05017?? ??? ?c06108
     t05017?? ??? ?c06172
     t06011?? ??? ?c06127
     t06023?? ??? ?c05127
     t06023?? ??? ?c06172
     t07019?? ??? ?c08106
     t08017?? ??? ?c08123
     t08058?? ??? ?c08171

數(shù)據(jù)庫作業(yè)
   (6)選課信息表se_course
   #se_course表結(jié)構(gòu)
     create table se_course
     (sc_no int(6) not null auto_increment,?
     studentno ?char(11) not null,?
     courseno ?char(6) not null,?
     teacherno char(6) not null, ?
     score ? int(3) ? ?null,
     sc_time timestamp not null default now(),?
     primary key (sc_no)
     );
   #se_course表常用數(shù)據(jù)示例
     sc_no ?studentno ? ?courseno ?teacherno ?score ? sc_time ? ? ??
     1 ? ? ? 21125111109 ? c06172 ? ?t05017 ? ? NULL ? ?2020-12-09 18:33:45
     2 ? ? ? 20120210009?? ?c06108?? ? ?t06023 ? ? NULL ? ?2020-12-24 18:30:15
     3 ? ? ? 20123567897?? ?t01239?? ? ?t05003 ? ? NULL ? ?2020-12-26 18:09:09

?數(shù)據(jù)庫作業(yè)

問題:

(1)在course表的cname列上創(chuàng)建索引IDX_cname。

(2)在student表的studentno和phone列上創(chuàng)建唯一索引uq_stu。并輸出student表中的記錄,查看輸出結(jié)果的順序。

(3)創(chuàng)建一個(gè)視圖v_teacher,查詢所有“計(jì)算機(jī)學(xué)院”教師的信息。

(4)創(chuàng)建一個(gè)視圖v_avgstu,查詢每個(gè)學(xué)生的學(xué)號(hào)、姓名及平均分,并且按照平均分降序排序。

(5)修改v_teacher的視圖定義,添加with check option選項(xiàng)。

(6)通過視圖v_teacher向基表teacher中分別插入數(shù)據(jù)('t05039','張馨月','計(jì)算機(jī)應(yīng)用', '講師', '計(jì)算機(jī)學(xué)院)和('t06018', '李書誠', '機(jī)械制造','副教授','機(jī)械學(xué)院'),并查看插入數(shù)據(jù)情況。

(7)通過視圖v_teacher將基表teacher中教師編號(hào)為t05039的教師職稱修改為‘副教授’。

答案:

1.

create index IDX_cname on course (cname);

select * from course;

數(shù)據(jù)庫作業(yè)

2.

create unique index uq_stu on student (studentno, phone);

select * from student;

數(shù)據(jù)庫作業(yè)

3.

create view v_teacher as select * from teacher where teacher.department='計(jì)算機(jī)學(xué)院';

select * from v_teacher;

數(shù)據(jù)庫作業(yè)

4.

create view v_avgstu as select student.studentno,student.sname,avg(score.final) as avg from student join score on student.studentno=score.studentno group by score.studentno order by avg desc;

select * from v_avgstu;

數(shù)據(jù)庫作業(yè)

5.

create view v_teacher as select * from teacher where teacher.department='計(jì)算機(jī)學(xué)院' with check option;

select * from v_teacher;

數(shù)據(jù)庫作業(yè)

6.(注意:這里需要使用第3題創(chuàng)建的視圖,因?yàn)檫@里插入了機(jī)械學(xué)院的數(shù)據(jù))

insert into v_teacher(teacherno,tname,major,prof,department) values('t05039','張馨月','計(jì)算機(jī)應(yīng)用','講師','計(jì)算機(jī)學(xué)院');

insert into v_teacher(teacherno,tname,major,prof,department) values('t06018', '李書誠', '機(jī)械制造','副教授','機(jī)械學(xué)院');

select * from v_teacher;

數(shù)據(jù)庫作業(yè)

7.

update v_teacher set prof='副教授' where teacherno='t05039';

select * from v_teacher;

數(shù)據(jù)庫作業(yè)文章來源地址http://www.zghlxwxcb.cn/news/detail-461576.html

到了這里,關(guān)于數(shù)據(jù)庫作業(yè)的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • 數(shù)據(jù)庫第一次作業(yè)

    數(shù)據(jù)庫第一次作業(yè)

    1.創(chuàng)建一個(gè)英雄表 create table t_hero ( ? ? ?id int primary key auto_increment, ? ? ?name varchar(10) unique not null, ? ? ?gender char(5) check (gender in (\\\'男\(zhòng)\\',\\\'女\\\')), ? ? ?grade char(5) default \\\'5星\\\', ? ? ?`groups` char(5) check (`groups` in (\\\'毀滅\\\',\\\'巡獵\\\',\\\'智識(shí)\\\',\\\'存護(hù)\\\',\\\'虛無\\\',\\\'豐饒\\\')), ? ? ?tel char(11) ? default \\\'

    2024年01月18日
    瀏覽(66)
  • MySQL數(shù)據(jù)庫設(shè)計(jì)作業(yè) ——《網(wǎng)上書店系統(tǒng)》數(shù)據(jù)庫設(shè)計(jì)實(shí)驗(yàn)報(bào)告

    MySQL數(shù)據(jù)庫設(shè)計(jì)作業(yè) ——《網(wǎng)上書店系統(tǒng)》數(shù)據(jù)庫設(shè)計(jì)實(shí)驗(yàn)報(bào)告

    普通用戶:可以進(jìn)行最基礎(chǔ)的登陸操作,可瀏覽圖書、按類別查詢圖書、查看 圖書的詳細(xì)信息,還可以注冊成為會(huì)員。 會(huì)員:需要填寫詳細(xì)信息(真實(shí)姓名、性別、手機(jī)號(hào)、地址、郵箱等),可瀏覽圖書、按類別查詢圖書、查看圖書的詳細(xì)信息,在此基礎(chǔ)上,還可以訂購圖

    2024年02月04日
    瀏覽(33)
  • 數(shù)據(jù)庫期末大作業(yè):機(jī)票預(yù)定信息系統(tǒng)數(shù)據(jù)庫設(shè)計(jì)與實(shí)現(xiàn)

    數(shù)據(jù)庫期末大作業(yè):機(jī)票預(yù)定信息系統(tǒng)數(shù)據(jù)庫設(shè)計(jì)與實(shí)現(xiàn)

    目錄 1、需求分析 2、數(shù)據(jù)庫設(shè)計(jì) 3、數(shù)據(jù)庫實(shí)現(xiàn) 4、數(shù)據(jù)庫的運(yùn)行(數(shù)據(jù)庫操作的相關(guān)SQL語句,包括查詢、增加、刪除、修改等) ?5、數(shù)據(jù)庫備份 ??????????有完整的word文檔、數(shù)據(jù)庫備份,有需要的可以私信找我拿?????????? 系統(tǒng)結(jié)構(gòu)簡述: 2.1、 概念結(jié)構(gòu)設(shè)計(jì)(

    2024年02月11日
    瀏覽(21)
  • 數(shù)據(jù)庫多表查詢作業(yè)

    數(shù)據(jù)庫多表查詢作業(yè)

    創(chuàng)建數(shù)據(jù)庫 插入數(shù)據(jù) 1.查詢student表的所有記錄 2.查詢student表的第2條到4條記錄 3.從student表查詢所有學(xué)生的學(xué)號(hào)(id)、姓名 (name)和院系(department)的信息 4.從student表中查詢計(jì)算機(jī)系和英語系的學(xué)生的信息 5.從student表中查詢年齡18~22歲的學(xué)生信息 6.從student表中查詢每個(gè)院

    2024年02月16日
    瀏覽(17)
  • 數(shù)據(jù)庫作業(yè)——select查詢操作

    數(shù)據(jù)庫作業(yè)——select查詢操作

    創(chuàng)建數(shù)據(jù)庫 插入數(shù)據(jù) 1、顯示所有職工的基本信息。 2、查詢所有職工所屬部門的部門號(hào),不顯示重復(fù)的部門號(hào)。 3、求出所有職工的人數(shù)。 4、列出最高工和最低工資。 5、列出職工的平均工資和總工資。 6、創(chuàng)建一個(gè)只有職工號(hào)、姓名和參加工作的新表,名為工作日期表。

    2024年02月13日
    瀏覽(28)
  • 數(shù)據(jù)庫作業(yè)-sql語句查詢

    建表的插入數(shù)據(jù)的表 數(shù)據(jù)庫作業(yè)-sql建表和插入數(shù)據(jù)_快樂的xiao何的博客-CSDN博客 create table supplier( supplierno char(6) primary key, suppliername nvarchar(10), address nvarchar(20), number char(11) )create table category( categoryno char(5) primary key, categoryname varchar(20), descriptions text... https://blog.csdn.net/m0_539670

    2023年04月23日
    瀏覽(34)
  • 第三章作業(yè):關(guān)系數(shù)據(jù)庫

    第三章作業(yè):關(guān)系數(shù)據(jù)庫

    同一個(gè)關(guān)系模型的任意兩個(gè)元組值(C ) A 必須全同 B 可全同 C 不能全同 D 以上都不是 設(shè)W=R∞S,且W,R,S的元組個(gè)數(shù)分別為p,m,n,那么三者之間滿足 D。 A. p(m+n) B. p≤(m+n) C. p(m×n) D. p≤(m×n) σF1(σF2(E))與 A 等價(jià)。 A. σF1∧F2(E) B. σF1(E) C. σF2(E) D. σF1∨F2(E) 設(shè)關(guān)系R和S的屬性個(gè)數(shù)分別

    2023年04月25日
    瀏覽(37)
  • 數(shù)據(jù)庫第二次作業(yè)

    數(shù)據(jù)庫第二次作業(yè)

    目錄 一、要求 二、操作 建表 插入數(shù)據(jù)? 1、顯示所有職工的基本信息 2、查詢所有職工所屬部門的部門號(hào),不顯示重復(fù)的部門號(hào)???編輯 3、求出所有職工的人數(shù)?編輯 4、列出最高工和最低工資 ?5、列出職工的平均工資和總工資 6、創(chuàng)建一個(gè)只有職工號(hào)、姓名和參加工作的

    2024年02月13日
    瀏覽(20)
  • 【數(shù)據(jù)挖掘】國科大蘇桂平老師數(shù)據(jù)庫新技術(shù)課程作業(yè) —— 第四次作業(yè)

    【數(shù)據(jù)挖掘】國科大蘇桂平老師數(shù)據(jù)庫新技術(shù)課程作業(yè) —— 第四次作業(yè)

    云計(jì)算與云數(shù)據(jù)庫背景 云計(jì)算(cloud computing)是 IT 技術(shù)發(fā)展的最新趨勢,正受到業(yè)界和學(xué)術(shù)界的廣泛關(guān)注。云計(jì)算是在分布式處理、并行處理和網(wǎng)格計(jì)算等技術(shù)的基礎(chǔ)上發(fā)展起來的,是一種新興的共享基礎(chǔ)架構(gòu)的方法。它可以自我維護(hù)和管理龐大的虛擬計(jì)算資源(包括計(jì)算

    2024年02月04日
    瀏覽(26)
  • mysql數(shù)據(jù)庫數(shù)據(jù)如何遷移目錄

    mysql數(shù)據(jù)庫數(shù)據(jù)如何遷移目錄

    默認(rèn)位置 C:ProgramDataMySQLMySQL Server 8.0 步驟2中Data文件夾就是mysql存放數(shù)據(jù)的位置 這里舉例移動(dòng)到E盤下 原來my.ini文件不要修改文件位置,如果修改需要另行學(xué)習(xí)

    2024年02月07日
    瀏覽(101)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包