mysql not between_sql not between 用法

sql> -- create demo table

sql> create table employee(

2 id varchar2(4 byte) not null,

3 first_name varchar2(10 byte),

4 last_name varchar2(10 byte),

5 start_date date,

6 end_date date,

7 salary number(8,2),

8 city varchar2(10 byte),

9 description varchar2(15 byte)

10 )

11 /

table created.

sql>

sql> -- prepare data

sql> insert into employee(id, first_name, last_name, start_date, end_date, salary, city, description)

2 values ('01','jason', 'martin', to_date('19960725','yyyymmdd'), to_date('20060725','yyyymmdd'), 1234.56, 'toronto', 'programmer')

3 /

1 row created.

sql> insert into employee(id, first_name, last_name, start_date, end_date, salary, city, description)

2 values('02','alison', 'mathews', to_date('19760321','yyyymmdd'), to_date('19860221','yyyymmdd'), 6661.78, 'vancouver','tester')

3 /

1 row created.

sql> insert into employee(id, first_name, last_name, start_date, end_date, salary, city, description)

2 values('03','james', 'smith', to_date('19781212','yyyymmdd'), to_date('19900315','yyyymmdd'), 6544.78, 'vancouver','tester')

3 /

1 row created.

sql> insert into employee(id, first_name, last_name, start_date, end_date, salary, city, description)

2 values('04','celia', 'rice', to_date('19821024','yyyymmdd'), to_date('19990421','yyyymmdd'), 2344.78, 'vancouver','manager')

3 /

1 row created.

sql> insert into employee(id, first_name, last_name, start_date, end_date, salary, city, description)

2 values('05','robert', 'black', to_date('19840115','yyyymmdd'), to_date('19980808','yyyymmdd'), 2334.78, 'vancouver','tester')

3 /

1 row created.

sql> insert into employee(id, first_name, last_name, start_date, end_date, salary, city, description)

2 values('06','linda', 'green', to_date('19870730','yyyymmdd'), to_date('19960104','yyyymmdd'), 4322.78,'new york', 'tester')

3 /

1 row created.

sql> insert into employee(id, first_name, last_name, start_date, end_date, salary, city, description)

2 values('07','david', 'larry', to_date('19901231','yyyymmdd'), to_date('19980212','yyyymmdd'), 7897.78,'new york', 'manager')

3 /

1 row created.

sql> insert into employee(id, first_name, last_name, start_date, end_date, salary, city, description)

2 values('08','james', 'cat', to_date('19960917','yyyymmdd'), to_date('20020415','yyyymmdd'), 1232.78,'vancouver', 'tester')

3 /

1 row created.

sql>

sql>

sql>

sql> -- display data in the table

sql> * from employee

2 /

id first_name last_name start_dat end_date salary city description

---- ---------- ---------- --------- --------- ---------- ---------- ---------------

01 jason martin 25-jul-96 25-jul-06 1234.56 toronto programmer

02 alison mathews 21-mar-76 21-feb-86 6661.78 vancouver tester

03 james smith 12-dec-78 15-mar-90 6544.78 vancouver tester

04 celia rice 24-oct-82 21-apr-99 2344.78 vancouver manager

05 robert black 15-jan-84 08-aug-98 2334.78 vancouver tester

06 linda green 30-jul-87 04-jan-96 4322.78 new york tester

07 david larry 31-dec-90 12-feb-98 7897.78 new york manager

08 james cat 17-sep-96 15-apr-02 1232.78 vancouver tester

8 rows selected.

sql>

sql>

sql> select * from employee where id not between 1 and 3;

id first_name last_name start_dat end_date salary city description

---- ---------- ---------- --------- --------- ---------- ---------- ---------------

04 celia rice 24-oct-82 21-apr-99 2344.78 vancouver manager

05 robert black 15-jan-84 08-aug-98 2334.78 vancouver tester

06 linda green 30-jul-87 04-jan-96 4322.78 new york tester

07 david larry 31-dec-90 12-feb-98 7897.78 new york manager

08 james cat 17-sep-96 15-apr-02 1232.78 vancouver tester

sql>

sql>

sql>

sql> -- clean the table

sql> drop table employee

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值