資料庫實訓心得

2021-03-04 02:32:27 字數 3775 閱讀 2426

課程設計報告

課程名稱:__ 資料庫課程設計

學院:__ 資訊工程學院

專業班級:__ 14計算機專(1)班 ______

學號:__ 2014039060

姓名史騰衛

指導老師阮丹丹

2014–2015 第二學期

目錄一、課程設計時間 2

二、課程設計地點 2

三、課程設計目的 2

四、課程設計任務及要求 2

五、課程設計內容 3

六、課程設計心得 3

此次課程設計是從2023年3月30號開始,至2023年4月3號結束,為期一周。

實驗樓s5-507機房

目的:《資料庫課程設計》實訓教學的主要目的是結合實際案例,通過實驗、實習,培養學生的對資料庫軟體的應用能力,熟練使用幾種資料庫開發技術的工具,比如sql server 2008。讓學生掌握資料庫、資料表、資訊、檢視等相關概念,熟悉資料庫的基本操作,學會使用sql語句,能夠動手設計出乙個簡單的資料庫系統,並完成資料庫的基本操作。

任務:(1)熟悉sql server 2005安裝配置及資料庫的建立和管理。

(2)學會通過sql語句建立與管理資料表。

(3)學生資料庫軟體的一些基本操作,增添、刪除、查詢、修改資料等。

(4)理解資料儲存的過程,掌握儲存過程的執行方法和儲存過程的管理和維護。

(5)了解檢視的概念,掌握建立檢視、測試、加密檢視的方法,掌握用檢視管理資料的方法。

(6)理解儲存過程概念、型別;掌握各種儲存過程建立方法和檢視、修改、刪除儲存過程方法。

5.1建立資料庫

資料庫**如下:

use master

goif exists(select *from sysdatabases where name='學生選課系統')

drop database 學生選課系統

create database 學生選課系統

go資料庫如圖:

圖一建立資料庫

5.2建立資料表

建立資料表的**如下:

use 學生選課系統

--建立資料表student

create table student

( sno char(8) not null primary key,--學號

sname varchar(12) not null,

*** char(2) not null default '男',

birth **alldatetime not null,

classno char(3) not null,

entrance_date **alldatetime

not null,

homeaddr varchar(40)

not null,

)create table course

(**o char(3) not null primary key, --課程號

**ame varchar(20) not null, --課程名稱

total_perior **allint, --總學時

credit tinyint, --學分

check (total_perior>3 and credit>0 and credit<=6)

)create table sc

(primary key(sno,**o),

sno char(8) not null foreign key references student(sno), --學號

**o char(3) not null foreign key references course(**o), --課程號

grade tinyint, --成績

check(grade>=0 and grade<=100)

)如圖所示:

圖二建立資料表

5.3新增和刪除約束

**如下:

drop table sc

drop table student

drop table course

--向student表中增加身高列

alter table student

add stature numeric(4,2),

constraint ck_stature check(stature<3.0)

--向student表中增加系別

alter table student

add sdept char(8) not null

--向student表中增加身郵政編碼

alter table student

add postcode char(6),

constraint ck_ps check(postcode like '[0-9][0-9][0-9][0-9][0-9][0-9]')

--刪除student表中的身高列

alter table student

drop ck_stature

alter table student

drop column stature

alter table student

add constraint ck_date check(birthalter table sc

add constraint ck_grade default(0) for grade

5.4插入資料向資料表中插入資料

插入資料**如下:

insert

into student

values ('20110001','張虹','男','1992-09-11','051',

'2011-09-01','南京','計算機系','200413')

insert

into student

values ('20110002','林紅','女','1991-08-11','051',

'2011-09-01','南京','計算機系','200413')

insert

into student

values ('20110003','林浩','男','1993-09-11','061',

'2011-09-01','上海','軟體工程','200413')

insert

into student

values ('20110004','方波','男','1990-09-11','061',

'2011-09-01','武漢','通訊工程','200413')

insert

into student

values ('20110005','李華','女','1988-09-11','052',

'2011-09-01','重慶','通訊工程','200413')

insert

into student

values ('20110105','劉小方','女','1992-09-11','052',

'2011-09-01','南昌','軟體工程','200413')

insert

into student

values ('20110103','宋江','男','1988-09-11','052',

'2011-09-01','南昌','軟體工程','200413')

如圖所示

圖三插入資料

5.5查詢表中資料

select *

from student_20103322

where sname like '張%'

如圖所示:

圖四查詢資料

資料庫實訓心得

乙個月的資料庫實訓就轉眼間就上完了,期間講解了乙個學生管理系統,最後還做了乙個小的資料庫鏈結作業。現在就說說關於vb鏈結的資料庫的一些方法。首先說資料庫,簡單的說就是建 然後把一張一張的 和在一起,成為一大堆的資料集合。他是依照某種資料結構組織起來並存放二級儲存器中的資料集合,基本分為三個層次,物理...

Access資料庫實訓心得

實訓心得 時光飛逝,我們的實訓生活就要結束了。經過短暫的乙個星期的實訓,我們學習到了許多以前不懂的操作 知識,也明白了實踐的重要性,更意識到了自己在計算機上還有許多不足。而最讓我感觸深刻的是團隊精神的重要。在操作中,我們遇到許多問題,比如我在建立表的途中,許多資料在輸入時,經常出現問題,不是這邊出錯...

資料庫實訓報告

實訓心得 經過一周的資料庫實訓,我們自信開發了乙個簡易的圖書管理系統,通過開發這樣乙個簡單的系統,我們希望能過達到讀者能方便的查閱各種書籍的資訊 內容,和查閱一些需要的資訊的功能。綜合觀察此系統可以簡單的分為以下四個模組 1 使用者登入管理 2 圖書資訊管理 3 讀者資訊管理 4 借閱資訊管理 通過...