For my college project, I have two SQL tables
one has the user data
USERNAME | PHONE NUMBER | RFID CARD NUMBER
other is a product database
PRODUCT NAME | PRODUCT PRICE | PRODUCT QUANTITY | BARCODE NUMBER
The idea is when I scan the barcode with an app on the phone, the scanned products, and their prices get added to the user's shopping database.
the shopping database is
USER ID | PRODUCTS SCANNED | EXIT STATUS
The USER IDis the foreign key of the RFID CARD NUMBER
I wanted to add the product barcode: price as an array/map, the only way I learned to add arrays into SQL is by using the JSON data type.
EXIT STATUS is a boolean column that is true/false based on whether the JSON column is null or not.
I know only the basics of SQL and from what I have read the only way to store an array in MySQL is JSON. but I don't know much about the usage of JSON data type.
Is there any other way to do the exact same approach of storing arrays, or better approaches that I can use for the current requirement?