Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can we use "NOT LIKE " in sql

Can we use "NOT LIKE '%abc%'" just opposite of LIKE '%abc%' ? i tried and got some result but dont look like correct!!

Is there anything similar to regex in SQL.

Eg:

i hae a table with 3 field.

id  name  address
1    xyz    1234 abcd 
2    abc    nomans land
3    omg    #123 new-york
3    nom    $123 &7up

can i fetch the address **with special characters with out checking each special character one by one . How

like image 242
zod Avatar asked Feb 15 '12 21:02

zod


1 Answers

In db2 (version 9.7.900.250), I've successfully specified "not like" this way:

select * from orders
where not(orders.order_number like 'S%')

This shows all orders where the order# does NOT start with a capital "S".

like image 136
Lonnie Best Avatar answered Sep 19 '22 21:09

Lonnie Best