<p>I'm using the following query, but I currently have to enter a value in every parameter for the query to work. Is there a way of making the parameters optional, so that 1 or more values will return a result?</p>

<pre><code>SELECT * FROM film
WHERE day LIKE '%day%'
AND month LIKE '%month%'
AND year LIKE '%year%'
</code></pre>

<hr>

<p>something like</p>

<pre><code> function queryData(year,month,day) 

 declare Y

 if year == nothing
     Y = '%'
 else
     Y = '%' + year + '%'

 declare M

 if month == nothing
     M = '%'
 else
     M = '%' + month + '%'

 declare D

 if day == nothing
     D = '%'
 else
     D = '%' + day + '%'

 return result of :

 SELECT * FROM film
 WHERE day LIKE D
 OR month LIKE M
 OR year LIKE Y
</code></pre>

```
```
SELECT * FROM film
WHERE day LIKE '%day%'
OR month LIKE '%month%'
OR year LIKE '%year%'
```
```
You will still be providing all three parameters, but it won't matter if they are blank or NULL, matches will still return from the ones that aren't blank.