1. 程式人生 > >【sql入門】根據要求繪製E/R圖,建立資料庫(1)繪製E/R圖

【sql入門】根據要求繪製E/R圖,建立資料庫(1)繪製E/R圖

第一步:根據題目判斷entiry,relationship和attribute。

例題:

You are required to create a conceptual model of the data requirements for a company that specializes in IT training. The Company offers a number of advanced technology courses, each of which is taught by a teaching team of two or more instructors.The Company has 30 instructors and each training course is taken up

a number of trainees. Each instructor is assigned to one or more teaching teams.

在這道題中,我用紅色標註出了entity,黃色高亮了entity之間的relationship。這道題省略了一些attribute,需要建表和繪圖時自行判斷新增,如果題目中明確給出entity的一些屬性,也需要用不同顏色標註出來。

第二步:根據標註後的題目繪圖,在這裡我將兩個M:M關係(多對多)轉換成多個1:M關係(1對多),因為M:M關係在建表過程中難以表示。

接下來就可以根據E/R圖建立database了。