交叉表查詢用的是一張表,怎麼出現一對多關係,對多...
- 2022-04-02
只要建立兩個表就能建立這樣的關係,因為你可以把多方的那個表設定一個Foreign Key 屬性 ,下面是一個部門和員工的表結構關係
在mysql 資料庫上應該這樣建立表結構:
create table department(
id int primary key,
name varchar(100)
);
create table employee(
id int primary key,
name varchar(100),
salary float(8,2),
dept_id int,
constraint dept_id_fk foreign key (dept_id) references department(id)//這個其實是約束條件,不是表格的屬性值。
);
from aaa as a,aaa as b,aaa as c
上一篇:如何去腳後跟死皮厚繭
下一篇:什麼是啞銀不乾膠啞銀是什?