dbms 2012 term project
DESCRIPTION
DBMS 2012 Term Project. 教授 : 李強 助教 : 郭晉元、黃品介 助教 E-mail: [email protected] DEMO 地點:雲平大樓東棟 3 樓 305 室 高等資料系統實驗室. DBMS Term Project. 目標 利用程式 語言 (EX: C, C++, JAVA… ) 自行 開發一個簡易的 DBMS ( 例如:人事薪資系統,學生學籍系統 … 等 ) , 作業系統不 限 、 實 作的程式語言不 限 → 禁止使用現成軟體 ( EX: mySQL ) 。 - PowerPoint PPT PresentationTRANSCRIPT
DBMS 2012 Term
Project
1
教授 : 李強助教 : 郭晉元、黃品介助教 E-mail: [email protected] 地點:雲平大樓東棟 3 樓 305 室 高等資料系統實驗室
DBMS Term Project
目標 利用程式語言 (EX: C, C++, JAVA… ) 自行開發一個簡易的 DBMS ( 例如:人
事薪資系統,學生學籍系統…等 ) ,作業系統不限、實作的程式語言不限 →禁止使用現成軟體 ( EX: mySQL ) 。
註:禁止使用作業一或課本現成的例子,作為你系統的資料。 分組需求
一人一組。 應用程式介面
需自行撰寫介面。該介面要可輸入 SQL 語法做查詢並顯示查詢結果。 Project 截止日期
2013/1/7( 一 )~2013/1/11( 五 ) 為 Demo 日期。 2012/11/28( 三 ) 中午 12:00 過後開放課程網站登記 project demo 時間, 系統於 2012/12/12( 三 ) 中午 12:00 關閉。 詳細的分組 demo 時間表會在公布於課程網頁上。
2
Project 說明
Project : 自行設計一個 Database 以及管理介面 (DBMS)
Database 需包含基本的資料結構 ( 如 Database 的資料結構,table 的資料結構,欄位的資料結構…等 )
需可以分析使用者所輸入的 SQL Query , 並將正確結果輸出 ( 輸出輸入格式不限 ) 。
實作的程式語言不限、作業系統不限。 例如:人事薪資系統、學生成績系統、學生學籍系統…等。
3
建立資料庫需要滿足的要求 Entity type 需求
◦ 最少 5 個 entity types Relationship 需求
需標示 relationship 間的 cardinality ratio ( 寫在 Document) Attribute 需求
◦ 每個 table 至少有 3 個 attributes◦ 每個 table 都要有 key attribute◦ 每個 table 至少有 5 筆不同的資料
4
Project :自行開發一個 DBMS
自行設計一個 DBMS ,包含資料庫格式、資料型態…等。此 DBMS 可編譯使用者輸入的 SQL 查詢,並可正確的把使用者要求的結果輸出。
資料庫功能需求: Basic queries in SQL ( 參考投影片 p.12)
SELECT-FROM-WHERE
Complex queries in SQL ( 參考投影片 p.13~15) Nested queries (IN) Aggregate functions (COUNT, SUM, MAX, MIN,
AVG) Grouping (GROUP BY & HAVING) (bonus)
5
評分標準
6
Total (100%) = demo(70%) + document(30%) Demo (70%)
Query 介面 : 需可輸入 SQL query 並輸出結果 (15%) 功能 (55%):
Basic SQL queries (30%) SELECT-FROM-WHERE (20%)
請做到可以 SELECT * (SELECT ALL 的意思 ) 。WHERE condition 連接至少要有 AND ( 要做到多個 AND 結合 ) 。Bonus (5%) :做到 AND 、 OR 的多重結合。
有 join 功能 (10%)
評分標準 (Cont.)
Complex SQL queries (25%)
Nested queries (IN) (10%)
請做到 NOT IN 也可以使用 ( 不用 EXISTS 、 NOT EXISTS) 。
Bonus (5%) :做到多層 IN 迴圈 ( 用超過 1 個 IN ) 。 Aggregate functions (COUNT, SUM, MAX, MIN, AVG)(15%)
5 個功能,每 1 個分別佔 2% ( 共 10%)
可以完整結合自己寫的 SELECT FROM WHERE 功能 (5%)
Group (Group By & Having) (bonus 10%)
請做到可以結合自己已做的所有功能7
8
評分標準 (Cont.)
Document 內容 (30%)
◦ 系統架構與環境 (5%)
◦ 介面截圖與使用說明 (5%)
◦ 資料庫設計 (20%)
E-R diagram 。 (13%)
( 需說明每個 table, attribute, relationship 的意義和關係並列出每個 table 所包含的資料內容 )
每個 SQL 指令碼、 SQL 指令說明與 SQL 執行結果。 (7%)
註: Project 嚴禁抄襲,抄襲一律零分!
Proejct 繳交內容要求
Program Source Code with Clear Explanations
Executable file
Document : 需包含評分標準要求的內容。
請所有同學在 2013/1/6( 日 )23:59 前將以上檔案壓縮上傳至 ftp://140.116.247.193 帳號 :dbms2012m 密碼 : 646587
檔名範例 : DBProject_ 學號 .zip or DBProject_ 學號 .rar 。逾時不收 !
9
Demo 同學可自行帶筆電 Demo 。 作業系統若不為 Windows ,請自行帶筆電 Demo 。
10
Operation requirements
11
Basic queries in SQL
SELECT-FROM-WHERE SELECT <attribute list>
FROM <table list> WHERE <condition>
Number of <attribute list> ranging from 1 to N. Number of <table list> ranging from 1 to N. Number of <condition> ranging from 0 to N. Logical comparison operators are =, <, <=, >, >=, !=
12
Query 1: Retrieve the name and address of all employees who work for the ‘Research’ department.Q1: SELECT FNAME,LNAME,ADDRESS FROM EMPLOYEE,DEPARTMENT WHERE DNAME =‘Research’ AND DNUMBER = DNO
Example
Complex queries in SQL
IN : Nested queries SELECT <attribute list> FROM <table list> WHERE <condition> IN ( SELECT <attribute
list> FROM <table list>
WHERE <condition> )
13
Query 5: Retrieve the name and address of all employees who work for the ‘Research’ department.Q5: SELECT FNAME,LNAME,ADDRESS FROM EMPLOYEE WHERE DNO IN ( SELECT DNUMBER FROM DEPARTMENT WHERE DNAME =‘Research’)
Example
Aggregate functions Include COUNT, SUM, MAX, MIN, and AVG
14
Query 6a: Find the maximum salary, the minimum salary, and the average salary among employees who work for the ‘Research’ department.Q6a:
SELECT MAX(SALARY),MIN(SALARY),AVG(SALARY) FROM EMPLOYEE,DEPARTMENT WHERE DNO=DNUMBER AND DNAME=‘Research’
Queries 6b: Retrieve the total number of employees in the companyQ6b: SELECT COUNT(*) FROM EMPLOYEE
Example
Complex queries in SQL(Cont.)
GROUP BY & HAVING : Grouping SELECT <attribute list> FROM <table list> WHERE <condition> GROUP BY <grouping attribute(s)> HAVING <group condition>
15
Query 7: For each project on which more than two employees work, retrieve the project number, project name, and the number of employees who work on that project.Q7: SELECT PNUMBER,PNAME,COUNT(*) FROM PROJECT,WORKS_ON WHERE PNUMBER=PNO GROUP BY PNUMBER,PNAME HAVING COUNT(*)>2
Example
Complex queries in SQL(Cont.)