1
1
17aPaBo3uK2018-06-01 14:44:56
SQL
17aPaBo3uK, 2018-06-01 14:44:56

SQL: How to select data from a field where an array is stored?

Hello everyone, help me to correctly compose a sql query.
I have a table Products (goods)
There is a field Color (colors) - field type = text
The data in the colors field is stored in this form:

1: red
2: blue
3: green
...

How to make a selection from the database if the user selected the color Red (ID = 1) in the filter form
What to write in WHERE?
SELECT * from goods WHERE colors = ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Fedorov, 2018-06-01
@qonand

Understand the normal forms on which relational databases should be built and bring the database into the proper state, and then all such questions will disappear

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question