How to create a table with a dynamic number. columns for data entry

I am currently working on a project where I need to save data depending on the active one. points.

Its like ..

There may be n items in stores that can be dynamically added or reduced from the admin. Each element can be activated or deactivated. No problems.

But I need to manage / save these dynamic n no. items in the table for each store. I cannot determine the table schema.

Any help would be greatly appreciated.

+3
source share
3 answers

" ", . , 3 :

  • StoresTable:
  • ItemsTable:
  • StoreItemsTable: , ,

, .

+4

, .

. , Susi 1 , 2, . , 2000 .

( , ) . .

:

Store table:
PK    Name             Owner
1     Sunshine Store   Susi
2     Moonstore        Harald

Item table:
PK    Name     Store_id        Price
1     Candle   1                2.44
2     Table    1               51.44
3     Chair    2                6.55

, . Store_id , . SQL , .

 "Select * from ITEMS where Store_id = 1;"

Susi .

!

+3

, , .

0

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


All Articles