More SQL Commands
Explore how to implement SQL wildcard searches that allow users to find their own journal entries securely. Understand the importance of generating user-specific queries to prevent unauthorized data exposure and learn a practical example using Java.
We'll cover the following...
We’ve seen how to search for an exact match. Now let’s see how to search for an approximate match using SQL’s wild card searches.
Searching for approximate matches
If we wanted to search for all the journal entries that contain the word “Time” we could execute the following SQL:
Whatever is between the % signs is the wildcard. This query returns the time stamp and journal entry for every row that contains the wildcard in the Body column. It doesn’t matter what comes before the wild card, what comes after the wildcard, or if the Body just ...