Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>That isn't really the way SQL works. You can get some of that same functionality, but it won't look anything like what you are asking; you are writing (naturally enough) in a more procedural style.</p> <p>For one thing "add results" is trying to bring (presumably) disparate things together into a single collection. You are - I think - asking for restaurants and cuisines and cities and postcodes all to go into the same collection, and the only kind of collection SQL has (roughly speaking) is tables, and within a table, all rows have the same type. </p> <p>But maybe restaurants and cuisine and city and postcode are all fields of the same table? Well, then, for a given word you could say</p> <pre><code>SELECT * FROM your_table WHERE restaurant like "%" + word + "%" OR cuisine like "%" + word + "%" OR city like "%" + word + "%" OR postcode like "%" + word + "%"; </code></pre> <p>It starts to get complicated when you want to match multiple words; this answer is intended as a starting point; maybe once you're more familiar with SQL you can ask easier-to-answer questions. Good luck!</p> <p><strong>Update</strong> based on your table descriptions</p> <pre><code>SELECT r.* FROM restaurant r INNER JOIN link k ON k.restaurant_id = r.restaurant_id INNER JOIN cuisine c on c.cuisine_id = k.cuisine_id WHERE r.restaurant like "%" + word + "%" OR c.name like "%" + word + "%" OR r.city like "%" + word + "%" OR r.postcode like "%" + word + "%"; </code></pre> <p>And don't worry about which records come back "first". Your database will be fast enough that that should not be a concern.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload