Simple demo for NOT IN : In « Select Clause « 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
PostgreSQL
MySQL Tutorial
SQL / MySQL » Select Clause » In 
Simple demo for NOT IN
  
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;

/* The names and titles of all non programmers are displayed.
*/
SELECT firstname, lastName, title from
       employee where title NOT IN
       ('Programmer', 'Senior Programmer',
       'Multimedia Programmer');

  

           
         
    
  
Related examples in the same category
1.Use IN for static values
2.Simple demo for IN
3.Use IN and order rows
4.Use IN for string value
5.Use IN and BETWEEN AND
6.Use IN in where clause
7.Find the match numbers and the number of sets won and lost of all matches that were won 3-1 or 3-2.
8.In operator and char type
9.SELECT statement uses the NOT IN operator
10.Constant value with in opertator
11.Comparisons with a large number of values can be carried out easily with IN:
12.Sub query with IN command
13.Sub query with NOT IN command
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.