TRUNCATE TABLE TB_NAME;--截断表,将表中的所有数据删除,并将数据原先占用的存储空间释放
DELETE FROM TB_NAME;--删除表中的所有数据,不将数据占用的内存资源释放
DELETE FROM TB_NAME;--删除表中的所有数据,不将数据占用的内存资源释放
2018-01-23
Oracle插入多条数据与mysql的SQL有点不同
INSERT ALL
INTO user_info (字段1,字段2,字段n) VALUES (值1,值2,值n)
INTO user_info (字段1,字段2,字段n) VALUES (值1,值2,值n)
INTO user_info (字段1,字段2,字段n) VALUES (值1,值2,值n)
INTO user_info (字段1,字段2,字段n) VALUES (值1,值2,值n)
SELECT 1 FROM DUAL ;
INSERT ALL
INTO user_info (字段1,字段2,字段n) VALUES (值1,值2,值n)
INTO user_info (字段1,字段2,字段n) VALUES (值1,值2,值n)
INTO user_info (字段1,字段2,字段n) VALUES (值1,值2,值n)
INTO user_info (字段1,字段2,字段n) VALUES (值1,值2,值n)
SELECT 1 FROM DUAL ;
2018-01-23
select username,decode(username,'aaa','计算机部门','bbb','市场部门','其他') as 部门 from users;
2018-01-10
select username,case when salary<800 then '工资低' when salary>5000 then '工资高' end as 工资水平 from users;
2018-01-10
select username,case username when 'aaa' then '计算机部门' when'bbb' then '市场部门' else '其他部门' end as 部门 from users;
select username,case when usename='aaa' then '计算机部门' when username='bbb' then '市场部门' else '其他部门' end as 部门 from users;
select username,case when usename='aaa' then '计算机部门' when username='bbb' then '市场部门' else '其他部门' end as 部门 from users;
2018-01-10
select * from users order by id desc;
select * from users order by id desc,salary asc;
insert into users values(4,'aaa',1000);
select * from users order by username desc,salary asc;
select * from users order by id desc,salary asc;
insert into users values(4,'aaa',1000);
select * from users order by username desc,salary asc;
2018-01-10
select * from users where salary beteen 800 and 2000;
select * from users where salary not beteen 800 and 2000;
select * from users where username in ('aaa','bbb');
select * from users where username not in ('aaa','bbb');
select * from users where salary not beteen 800 and 2000;
select * from users where username in ('aaa','bbb');
select * from users where username not in ('aaa','bbb');
2018-01-10
select * from users;
select * from users where username like 'a%';
select * from users where username like 'a_';
select * from users where username like '_a%';
select * from users where username like '%a%';
select * from users where username like 'a%';
select * from users where username like 'a_';
select * from users where username like '_a%';
select * from users where username like '%a%';
2018-01-10
select * from users;
select id,username,salary+200 from users;
select * from users;
select username from users where salary>800;
select username from users where salary>800 and salary<>1800.5;
select username form users where salary>800 or salary<>1800.5;
select id,username,salary+200 from users;
select * from users;
select username from users where salary>800;
select username from users where salary>800 and salary<>1800.5;
select username form users where salary>800 or salary<>1800.5;
2018-01-10