150 likes | 320 Views
DBMS 2012 Term Project. 教授 : 李強 助教 : 郭晉元、黃品介 助教 E-mail: dbms_m_ta@dblab.csie.ncku.edu.tw DEMO 地點:雲平大樓東棟 3 樓 305 室 高等資料系統實驗室. DBMS Term Project. 目標 利用程式 語言 (EX: C, C++, JAVA… ) 自行 開發一個簡易的 DBMS ( 例如:人事薪資系統,學生學籍系統 … 等 ) , 作業系統不 限 、 實 作的程式語言不 限 → 禁止使用現成軟體 ( EX: mySQL ) 。
E N D
DBMS 2012 Term Project 教授: 李強 助教: 郭晉元、黃品介 助教E-mail: dbms_m_ta@dblab.csie.ncku.edu.tw DEMO地點:雲平大樓東棟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 時間表會在公布於課程網頁上。
Project 說明 • Project: • 自行設計一個 Database 以及管理介面(DBMS) • Database需包含基本的資料結構 (如 Database 的資料結構,table 的資料結構,欄位的資料結構…等) • 需可以分析使用者所輸入的SQL Query , 並將正確結果輸出 (輸出輸入格式不限) 。 • 實作的程式語言不限、作業系統不限。 • 例如:人事薪資系統、學生成績系統、學生學籍系統…等。
建立資料庫需要滿足的要求 • Entity type 需求 • 最少 5 個 entity types • Relationship 需求 • 需標示 relationship 間的 cardinality ratio (寫在Document) • Attribute 需求 • 每個table 至少有 3 個 attributes • 每個 table 都要有 key attribute • 每個 table 至少有 5 筆不同的資料
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)
評分標準 • Total (100%) = demo(70%) + document(30%) • Demo (70%) • Query 介面:需可輸入SQLquery並輸出結果(15%) • 功能 (55%): • Basic SQL queries (30%) • SELECT-FROM-WHERE(20%) 請做到可以 SELECT * (SELECTALL的意思)。 WHERE condition連接至少要有 AND (要做到多個AND結合)。 Bonus (5%) :做到 AND 、OR 的多重結合。 • 有join功能 (10%)
評分標準(Cont.) • Complex SQL queries (25%) • Nested queries (IN) (10%) 請做到NOTIN 也可以使用(不用EXISTS、NOTEXISTS)。 Bonus (5%):做到多層 IN 迴圈 (用超過1個 IN)。 • Aggregate functions (COUNT, SUM, MAX, MIN, AVG)(15%) 5個功能,每1個分別佔2%(共10%) 可以完整結合自己寫的 SELECTFROMWHERE 功能(5%) • Group (Group By & Having) (bonus 10%) 請做到可以結合自己已做的所有功能
評分標準(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 。逾時不收 !
Demo 同學可自行帶筆電Demo。 作業系統若不為Windows,請自行帶筆電Demo。
Basic queries in SQL Example 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 • 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 =, <, <=, >, >=, !=
Complex queries in SQL Example 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’) • IN:Nested queries SELECT <attribute list> FROM <table list> WHERE <condition> IN ( SELECT <attribute list> FROM <table list> WHERE <condition> )
Complex queries in SQL(Cont.) Example • Query 6a: Find the maximum salary, the minimum salary, and the average salary among employees who work for the ‘Research’ department. • Q6a: • SELECTMAX(SALARY),MIN(SALARY),AVG(SALARY) • FROM EMPLOYEE,DEPARTMENT • WHERE DNO=DNUMBER AND DNAME=‘Research’ • Queries 6b: Retrieve the total number of employees in the company • Q6b: • SELECT COUNT(*) • FROM EMPLOYEE • Aggregate functions • Include COUNT, SUM, MAX, MIN, andAVG
Complex queries in SQL(Cont.) Example 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 HAVINGCOUNT(*)>2 • GROUP BY & HAVING:Grouping SELECT<attribute list> FROM <table list> WHERE <condition> GROUP BY<grouping attribute(s)> HAVING <group condition>