You should not store SQL statements in a database. I would recommend you do something like this:
CREATE TABLE store ( id INT NOT NULL PRIMARY KEY, name VARCHAR(100) );
Examples of lines: (1, "Amazon"), (2, "Walmart"), ...
CREATE TABLE search_filter ( id INT NOT NULL PRIMARY KEY, user_id INT NOT NULL, name VARCHAR(100), price_min INT, price_max INT, store_id INT, has_free_delivery BOOLEAN, keyword VARCHAR(50), FOREIGN KEY (user_id) REFERENCES user(id), FOREIGN KEY (store_id) REFERENCES store(id) );
Example line: (1, 43, "amazon christmas", 1000, 1999, 1, True, "christmas")
In the above example, a filter called "amazon christmas" will be saved associated with user 43. It indicates that the user wants to search for products with prices between $ 1,000 and $ 1,999 in Walmart with free shipping and contain the keyword "christmas." "
andebauchery
source share