Files
order_system/creat_table.txt
2025-09-15 17:36:13 +08:00

30 lines
994 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

請根據以下需求幫我產生一段 Python 程式碼能夠連線到資料庫並建立三張employee、 menu_items、employee_votes 資料表。
資料庫資訊:
DB_HOST = mysql.theaken.com
DB_PORT = 33306
DB_NAME = db_A027
DB_USER = A027
DB_PASSWORD = E1CelfxqlKoj
需求:
1. 使用 mysql.connector 套件。
2. 建立三張名稱為employee、 menu_items、employee_votes 的資料表,包含以下欄位:
2.1 TABLE名稱 employee(員工檔)
-id : 員工工號(NVARCHAR)
-name : 員工姓名(NVARCHAR)
2.2 menu_items菜色基本資料
-id : NUMBER(自動編號)
-main_course : 主餐(NVARCHAR)
-side_dish : 副餐(NVARCHAR)
-addon : 湯品/甜點(NVARCHAR)
-menu_date :當天菜色(DATE)
2.3 employee_votes餐點訂購檔
-id : NUMBER(自動編號)
-emp_id : 工號(NVARCHAR)
-order_date : 訂餐日期(DATE)
-menu_item_id: 投票選擇的餐點(NUMBER)
-order_qty : 訂餐份數(NUMBER)