Iám so new in this, and learning... I could use som help to a problem. I want to search in a table. I´m searching in for lastnames with the letter s in it. How do I do that? (Oracle SQL) I wrote: select fnamn,enamn from customers where enamn LIKE 's%'; I have tried a sevral combinatins now...
You're close. To search for the letter 's' anywhere in the name, you need to add an additional wild card to your search like this: '%s%'. That will find it anywhere within the name. But, understand, that will also lead to a scan of the table and possibly slow performance.
Grant is right - it won't be performant, but it is the answer... SELECT fnamn, enamn FROM Customers WHERE enamn LIKE '%s%' As you can see, it's all but identical to the code you showed. The % wildcard matches zero or more characters; there's also an _ wildcard that matches a single character. You can also build up not-quite-regular-expressions: SELECT enamn FROM Customers WHERE enamn LIKE '%[xyz]%' This will show you all names where there's a letter from what I've heard described as "the arse end of the alphabet". There are some other tricks to learn - see the documentation for [LIKE] for more ideas. :