Save space in the Mysql table

Hi, can someone tell me how to save the seating arrangement, which is the nXm matrix in the mysql table. Below we describe how we generate the nXm table

  • Admin indicates the number of rows and column of the bus
  • Admin selects whether a particular matrix element

    • Seat
    • Paragraph
    • Sleeping

    Note. The sleeping element occupies 2 elements.

  • This matrix must be stored in the database.

I want each matrix element to have a unique identifier with one exception in case of sleeping, two elements are the same

+3
source share
1 answer

MatrixTable

|MatrixID|Rows|Colls|

where MatrixID is the primary key

SeatTakenTable

|MatrixID|Row|Column|PassangerType|ElementID|

Where all columns are the main layout symbol

, "" .

SetTaken ElemntID

+2

Source: https://habr.com/ru/post/1782542/


All Articles