MySQL command to search for CSV (or similar array)

I am trying to write an SQL query that will search in a CSV (or similar) array in a column. Here is an example:

paste into the set of properties Bedrooms = 1,2,3 (or 1-3) title = nice property price = 500

I would then search for where bedrooms = 2+. Is it possible?

+1
source share
2 answers

This is usually not how you should store data in a relational database.

Perhaps you should have a column MinBedroomand MaxBedroom. For example:

SELECT * FROM properties WHERE MinBedroom > 1 AND MaxBedroom < 3;
+2
source

SQL - . . "-", SQL.

, , , , , . , , , .

SELECT * FROM properties WHERE bedrooms RLIKE '[[:<:]]2[[:>:]]';

, , , . , , , , . :

  • , ?
  • , ?
  • ?
  • , ? . "1,2, "?

, .


, , , .

+4

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


All Articles