节省座位安排在Mysql表中 [英] saving seat arrangement in Mysql table
问题描述
Hi可以有人建议我一种方式来节省座位安排,这是一个mysql表中的nxm矩阵。以下是我们如何生成nXm表
- Admin指定总线的行数和列数
-
管理员选择矩阵的特定元素是
- 座位
- 睡眠
注意:睡眠者占据2个元素
- 此矩阵必须保存在数据库中
我希望矩阵的每个元素都具有唯一性id在一个睡眠者的情况下有两个元素相同
MatrixTable
| MatrixID | Rows | Colls |
其中MatrixID是主键
SeatTakenTable
| MatrixID | Row | Column | PassangerType | ElementID |
其中所有列都是复合主键
<
对于一个睡眠者,你将hae插入两行具有相同ElemntID
的SetTaken表
Hi can some one suggest me a way to save seat arrangement which is nXm matrix in a mysql table. Following are how we generate the nXm table
- Admin specifies the no of rows and column of a bus
Admin selects whether a particular element of matrix is a
- Seat
- Passage
- Sleeper
Note: A sleeper occupies 2 elements
- This matrix has to be saved in the database
I want each element of the matrix to have a unique id with one exception in case of a sleeper two elements are same
MatrixTable
|MatrixID|Rows|Colls|
where MatrixID is the primary key
SeatTakenTable
|MatrixID|Row|Column|PassangerType|ElementID|
Where all Columns are the composit primary key
There is no nead to save free seats because there wont be any collusions when you use this "logical" key
For a sleeper you will hae to insert two rows in the SetTaken table with the same ElemntID
这篇关于节省座位安排在Mysql表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!