第一篇:數(shù)據(jù)庫實訓心得(最終版)
課程設(shè)計報告
題目:學生選課系統(tǒng)數(shù)據(jù)庫的設(shè)計與實現(xiàn)
課 程 名 稱:__ 數(shù)據(jù)庫課程設(shè)計
學 院:__ 信息工程學院___________
專 業(yè) 班 級:__ 14計算機專(1)班 ______
學 號:__ 2014039060 _
姓 名:__ 史騰衛(wèi) _________
指 導 老 師:__ 阮丹丹___________
2014–2015 第二學期
目錄
一、課程設(shè)計時間.........................................................2
二、課程設(shè)計地點.........................................................2
三、課程設(shè)計目的.........................................................2
四、課程設(shè)計任務(wù)及要求...................................................2
五、課程設(shè)計內(nèi)容.........................................................3
六、課程設(shè)計心得.........................................................7
I
一、課程設(shè)計時間
此次課程設(shè)計是從2015年3月30號開始,至2015年4月3號結(jié)束,為期一周。
二、課程設(shè)計地點
實驗樓S5-507機房
三、課程設(shè)計目的
目的:
《數(shù)據(jù)庫課程設(shè)計》實訓教學的主要目的是結(jié)合實際案例,通過實驗、實習,培養(yǎng)學生的對數(shù)據(jù)庫軟件的應(yīng)用能力,熟練使用幾種數(shù)據(jù)庫開發(fā)技術(shù)的工具,比如SQL Server 2008。讓學生掌握數(shù)據(jù)庫、數(shù)據(jù)表、信息、視圖等相關(guān)概念,熟悉數(shù)據(jù)庫的基本操作,學會使用SQL語句,能夠動手設(shè)計出一個簡單的數(shù)據(jù)庫系統(tǒng),并完成數(shù)據(jù)庫的基本操作。
四、課程設(shè)計任務(wù)及要求
任務(wù):
(1)熟悉SQL Server 2005安裝配置及數(shù)據(jù)庫的建立和管理。(2)學會通過SQL語句創(chuàng)建與管理數(shù)據(jù)表。
(3)學生數(shù)據(jù)庫軟件的一些基本操作,增添、刪除、查詢、修改數(shù)據(jù)等。(4)理解數(shù)據(jù)存儲的過程,掌握存儲過程的執(zhí)行方法和存儲過程的管理和維護。(5)了解視圖的概念,掌握創(chuàng)建視圖、測試、加密視圖的方法,掌握用視圖管理數(shù)據(jù)的方法。
(6)理解存儲過程概念、類型;掌握各種存儲過程創(chuàng)建方法和查看、修改、刪除存儲過程方法。
五、課程設(shè)計內(nèi)容
5.1創(chuàng)建數(shù)據(jù)庫
數(shù)據(jù)庫代碼如下:
USE master GO IF EXISTS(SELECT *FROM sysdatabases WHERE NAME='學生選課系統(tǒng)')DROP DATABASE 學生選課系統(tǒng) CREATE DATABASE 學生選課系統(tǒng)
GO 數(shù)據(jù)庫如圖:
圖一創(chuàng)建數(shù)據(jù)庫
5.2創(chuàng)建數(shù)據(jù)表
創(chuàng)建數(shù)據(jù)表的代碼如下: USE 學生選課系統(tǒng)
--創(chuàng)建數(shù)據(jù)表Student CREATE TABLE Student(Sno char(8)not null primary key,--學號 Sname varchar(12)not null, Sex char(2)not null default '男', Birth smalldatetime not null, Classno char(3)not null, Entrance_date smalldatetime
not null, Homeaddr varchar(40)not null,)create table Course(Cno char(3)not null primary key,--課程號 Cname varchar(20)not null,--課程名稱 Total_perior smallint,--總學時 Credit tinyint,--學分
check(Total_perior>3 and Credit>0 and Credit<=6))
create table SC(primary key(Sno,Cno), Sno char(8)not null foreign key references Student(Sno),--學號
Cno char(3)not null foreign key references Course(Cno),--課程號
Grade tinyint,--成績
check(Grade>=0 and Grade<=100))如圖所示:
圖二創(chuàng)建數(shù)據(jù)表
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(Birth alter table SC add constraint ck_grade default(0)for Grade 5.4插入數(shù)據(jù) 向數(shù)據(jù)表中插入數(shù)據(jù) 插入數(shù)據(jù)代碼如下: 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')如圖所示 圖三插入數(shù)據(jù) 5.5查詢表中數(shù)據(jù) select * from Student_20103322 where Sname like '張%' 如圖所示: 圖四查詢數(shù)據(jù) 六、課程設(shè)計心得 從這次試訓中讓我們更明白了一些知識,表是數(shù)據(jù)庫最重要的一個數(shù)據(jù)對象,表的創(chuàng)建好壞直接關(guān)系到數(shù)據(jù)庫的成敗,表的內(nèi)容是越具體越好,但是也不能太繁瑣,以后在實際運用中使用多表,對表的規(guī)劃和理解就會越深刻。通過這次試訓,讓我深刻的了解到自己的不足,要想對進行數(shù)據(jù)庫更深的學習,自己得要多看有關(guān)的課外書籍,并多做練習,不懂得要多問同學和請教老師,以解決自己遇到的難題,知道更多的知識。實訓不僅是讓我們在實踐中對理論知識的驗證,也讓我們知道我們多學的知識在社會上的運用,把所學知識和企業(yè)商業(yè)接軌。 這次實訓,不僅讓我們學到了許多有關(guān)數(shù)據(jù)庫的知識,老師也給我們講了很多社會現(xiàn)狀和就業(yè)情況,讓我們不同的角度了解這個專業(yè)的就業(yè)趨勢。讓我們在今后的學習中更有動力的充實自己,曾加自己的知識面和鍛煉自己各方面能力。 一個月的數(shù)據(jù)庫實訓就轉(zhuǎn)眼間就上完了,期間講解了一個學生管理系統(tǒng),最后還做了一個小的數(shù)據(jù)庫鏈接作業(yè)?,F(xiàn)在就說說關(guān)于vb鏈接的數(shù)據(jù)庫的一些方法。 首先說數(shù)據(jù)庫,簡單的說就是建表格,然后把一張一張的表格和在一起,成為一大堆的數(shù)據(jù)集合。他是依照某種數(shù)據(jù)結(jié)構(gòu)組織起來并存放二級存儲器中的數(shù)據(jù)集合,基本分為三個層次,物理數(shù)據(jù)層,概念數(shù)據(jù)層和邏輯數(shù)據(jù)層。不同層次間的聯(lián)系是通過映射來轉(zhuǎn)換的。 大多數(shù)vb鏈接數(shù)據(jù)庫都使用ado控件,他可以分為分為有源數(shù)據(jù)庫和無源數(shù)據(jù)庫,即是否使用了dsn數(shù)據(jù)源。在連接數(shù)據(jù)庫前首先要在vb菜單中“工程”-“引用”或“部件”從中選擇 microsoft activex data objects 2.6 library和 microsoft activex data objects recordset 2.6兩個組件,然后定義鏈接的對象,用什么名字由自己決定。下面的代碼也要由自己建立的數(shù)據(jù)庫來具體設(shè)置參數(shù)。 set db = new adodb.connection set xs = new adodb.recordset conn.connectionstring = “dsn=login;uid=;pwd=;” conn.connectiontimeout = 30 conn.open rs.open “select 用戶名 from login”, conn, adopenstatic, adlockreadonly, adcmdtext dim i as string for t = 0 to val(rs.recordcount)-1 i = trim(rs.fields(“用戶名”).value) rs.movenext combo1.additem i next t rs.close 這樣數(shù)據(jù)庫也就基本上鏈接好了。 實訓心得 時光飛逝,我們的實訓生活就要結(jié)束了。經(jīng)過短暫的一個星期的實訓,我們學習到了許多以前不懂的操作、知識,也明白了實踐的重要性,更意識到了自己在計算機上還有許多不足。而最讓我感觸深刻的是團隊精神的重要。 在操作中,我們遇到許多問題,比如我在建立表的途中,許多數(shù)據(jù)在輸入時,經(jīng)常出現(xiàn)問題,不是這邊出錯就是那邊出錯,不過后來也解決了問題,完成了表的建立和所需的前提工作。在后來的操作中,我們遇到了更多地問題。曾經(jīng)老師講過的步驟也聽得懂,可一實踐就重重受阻,就在我們非常焦急,想“怠工”時,我們隊員相互鼓勵,相互幫助,一步一步做,仔仔細細,一個一個排查錯誤,遇到不會的酒請教他人。最后總算是功夫沒白費,我們用自己的雙手完成了自己的任務(wù),當時心里感到特別的有成就感。當然這還是要感謝我的隊員們,一群可愛的人。 我感觸最深的是我們大家一起做查詢、報表、窗體??時那種投入,努力的精神。雖然在做查詢時有好多查詢步驟都沒有做成功,但是我們努力了,共同合作過,那么就要相信自己,向老師請教,解決問題,不會的操作就要學會,使我們這次的實訓成為真正的鍛煉。通過這次實訓,我們對電腦有了更深刻的認識,更讓我有機會體驗做系統(tǒng)程序的過程是不易的。這將會成為我一生中的寶貴經(jīng)驗,也會激發(fā)我對電腦操作的學習。我明白只有不斷學習,不斷充實,才能夠提高自己的能力。更要感謝我們一起的團隊,大家的相互激勵幫助 才完成了今天的任務(wù),這種動力是無窮的。我想說這次實訓令我今生難忘,途中的心酸,快樂會讓我回味無窮??蓯鄣耐閭儯覀兊挠颜x永留心間,我們是最棒的! 12:update sc set grade=grade+5 where cno='c01' 運行結(jié)果: 13:delete sc where cno=(select cno from course where cname ='高等數(shù)學')運行結(jié)果: 14:create unique index ind_cname on course(cname)運行結(jié)果: 1:use school go create view avggrade as select s.sdept,avg(sc.grade)as'avggrade' from student s,sc sc where s.sno=sc.sno and sc.grade is not null group by s.sdept go select * from avggrade go 實訓報告 實訓課程: JAVA WEB項目實訓 實訓名稱: JAVA項目實訓綜合能力培養(yǎng) 實訓地點:中國江蘇無錫國家軟件園巨蟹座C601 學生姓名:胥康 學號:140703133 指導教師:張志華 實訓時間:2016年7月22日 實訓數(shù)據(jù)庫MySQL與JAVA 編程 一、實訓目的 熟悉掃描器結(jié)構(gòu)及工作原理,監(jiān)測輸入實訓結(jié)果分析,通過該實訓,從設(shè)計到性能測試完成完整的實訓流程,鍛煉同學編程能力、測試能力、設(shè)計能力、全局把控能力、學習能力、動手能力和分析問題能力等。 二、實訓內(nèi)容 1、設(shè)計好數(shù)據(jù)庫結(jié)構(gòu),錄入測試數(shù)據(jù)五條以上。 2、通過標準Statement語句對象,完成增刪改查四個類編程。 三、實訓器材 教學投影機一臺、個人筆記本電腦一臺、本地服務(wù)器一臺(教師機) 四、實訓步驟與結(jié)果 /** *功能:完成數(shù)據(jù)查詢 */ package com.ec; import java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.Statement;/** * @author xukang * */ public class SelectData { /** * @paramargs * */ public static void main(String[] args)throws Exception{ Class.forName(“com.mysql.jdbc.Driver”); String url=“jdbc:mysql://localhost:3306/ECDB1?useSSL=false”; String user=“root”; String password=“12345678”; Connection conn=DriverManager.getConnection(url,user,password); Statement st=conn.createStatement(); String sql=“select * from ware”; ResultSet r=st.executeQuery(sql); while(r.next()){ System.out.println(r.getInt(1)+“t”+r.getString(2)+“t”+r.getFloat(3)+“t”+r.getString(4)+“t”+r.getString(5)+“t”+r.getString(6)); } r.close(); st.close(); conn.close(); // TODO Auto-generated method stub } } /** * 功能:完成數(shù)據(jù)插入工作 */ package com.ec; import java.net.PasswordAuthentication;import java.sql.Connection;import java.sql.DriverManager;import java.sql.Statement;/** * @author xukang * */ public class InsetData { /** * @paramargs */ public static void main(String[] args)throws Exception{ Class.forName(“com.mysql.jdbc.Driver”); String url=“jdbc:mysql://localhost:3306/ECDB1?useSSL=false”; String user=“root”; String password=“12345678”; Connection conn=DriverManager.getConnection(url,user,password); Statement st=conn.createStatement(); //關(guān)鍵點:查詢---executeQuery()增刪改-----executeUpdate()/executeLargeUpdate() String sql=“insert into ware values(10,'蛋糕',100.0,'快樂','黃色','徐州')”; st.executeUpdate(sql); // TODO Auto-generated method stub st.close(); conn.close(); } } /** * */ package com.ec; import java.sql.Connection;import java.sql.DriverManager;import java.sql.Statement; import org.omg.PortableInterceptor.USER_EXCEPTION; import com.mysql.jdbc.Driver;/** * @author asus * */ public class UpdateData { /** * @param args */ public static void main(String[] args)throws Exception{ Class.forName(“com.mysql.jdbc.Driver”); String url=“jdbc:mysql://localhost:3306/ECDB1?useSSL=false”; String user=“root”; String password=“12345678”; Connection conn=DriverManager.getConnection(url,user,password); Statement st=conn.createStatement(); String sql=“update ware set name='飛機' where id=6”; st.executeUpdate(sql); st.close(); conn.close(); // TODO Auto-generated method stub } } /** * */ package com.ec; import java.sql.Connection;import java.sql.DriverManager;import java.sql.Statement;/** * @author xukang * */ public class DeleteData { /** * @paramargs */ public static void main(String[] args)throws Exception{ Class.forName(“com.mysql.jdbc.Driver”); String url=“jdbc:mysql://localhost:3306/ECDB1?useSSL=false”; String user=“root”; String password=“12345678”; Connection conn=DriverManager.getConnection(url,user,password); Statement st=conn.createStatement(); String sql=“delete from ware where id=10”; st.executeUpdate(sql); st.close(); conn.close(); // TODO Auto-generated method stub } } 五、分析與結(jié)論 針對實訓的測試結(jié)果其中重要的結(jié)論如下: 通過掃描器課題的實訓課程的學習,掌握了java基本掃描器工作原理、結(jié)構(gòu)設(shè)計,形成了完整的java的認識,激發(fā)了對java的研究興趣,同時通過該課程鍛煉了自己的針對目標的學習能力、分析能力和動手能力。第二篇:數(shù)據(jù)庫實訓心得
第三篇:Access數(shù)據(jù)庫實訓心得
第四篇:數(shù)據(jù)庫實訓
第五篇:數(shù)據(jù)庫實訓報告