Pattern match: contain substring : Contains « Regular Expression « SQL / MySQL

Home
SQL / MySQL
1.Aggregate Functions
2.Backup Load
3.Command MySQL
4.Cursor
5.Data Type
6.Database
7.Date Time
8.Engine
9.Event
10.Flow Control
11.FullText Search
12.Function
13.Geometric
14.I18N
15.Insert Delete Update
16.Join
17.Key
18.Math
19.Procedure Function
20.Regular Expression
21.Select Clause
22.String
23.Table Index
24.Transaction
25.Trigger
26.User Permission
27.View
28.Where Clause
29.XML
SQL / MySQL » Regular Expression » Contains 
Pattern match: contain substring
    
Drop table employee;

CREATE TABLE employee (
    id int unsigned not null auto_increment primary key,
    firstname varchar(20),
    lastname varchar(20),
    title varchar(30),
    age int,
    yearofservice int,
    salary int,
    perks int,
    email varchar(60)
)



INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, emailvalues ("John""Chen""Senior Programmer"31312000025000"[email protected]");

INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, emailvalues ("Jan""Pillai""Senior Programmer"32411000020000"[email protected]");

INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, emailvalues ("Ane""Pandit""Web Designer"2439000015000"[email protected]");

INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, emailvalues ("Mary""Anchor""Web Designer"2728500015000"[email protected]");

INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, emailvalues ("Fred""King""Programmer"3237500015000"[email protected]");
INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, emailvalues ("John""Mac""Programmer"3248000016000"[email protected]");
INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, emailvalues ("Arthur""Sam""Programmer"2827500014000"[email protected]");
INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, emailvalues ("Alok""Nanda""Programmer"3237000010000"[email protected]");
INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, emailvalues ("Susan""Ra""Multimedia Programmer"3249000015000"[email protected]");
INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, emailvalues ("Paul""Simon""Multimedia Programmer"2318500012000"[email protected]");
INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, emailvalues ("Edward""Parhar""Multimedia Programmer"3027500015000"[email protected]");
INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, emailvalues ("Kim""Hunter""Senior Web Designer"32411000020000"[email protected]");
INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, emailvalues ("Roger""Lewis""System Administrator"32310000013000"[email protected]");
INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, emailvalues ("Danny""Gibson""System Administrator"3129000012000"[email protected]");
INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, emailvalues ("Mike""Harper""Senior Marketing Executive"36112000028000"[email protected]");
INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, emailvalues ("Mary""Sunday""Marketing Executive"3159000025000"[email protected]");
INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, emailvalues ("Jack""Sim""Marketing Executive"2717000018000"[email protected]");
INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, emailvalues ("Joe""Irvine""Marketing Executive"2717200018000"[email protected]");
INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, emailvalues ("Henry""Ali""Customer Service Manager"323700009000"[email protected]");
INSERT INTO employee (firstname, lastName, title, age, yearofservice, salary, perks, emailvalues ("Peter""Champion""Finance Manager"32212000025000"[email protected]");

select from employee;
       
SELECT firstname, lastName, title from employee
where title NOT LIKE "%programmer%";
           
         
    
    
    
  
Related examples in the same category
1.String contains
2.Pattern match: string contains
3.Show records where the name contains a "W"
4.Show records where the name contains a "W" or a "N"
5.Checking Whether a String Contains a Substring
6.Strings that contain a particular substring anywhere:
7.Strings that contain a substring at a specific position
8.Strings that contain a particular substring at any position:
9.Strings that contain a particular substring at a specific position:
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.