简单的spl语句

1.查询函数

select * from t_name字符串

2.删除where后面能够添加多个删除条件用and链接table

delete t_name t where t.userid ='12'date

3.返回规定数目select

select * from t_name where rownum <= 5搜索

4.判断某值不为空数据

select * from t_name t where t.userid is not null查询

5.为已有的表添加字段tab

alter table t_name add (字段名,类型)vi

6.截取子字符串。

substr,substrb

(1)均是字符串截取函数,都有三个参数,第一个是所要截取的字符串,第二个start,第三个是长度

(2)对于字母来讲,两个是同样的,可是汉字第一个是按字来取值,第二个是按字节来取值,当所取长度为奇数时,自动舍弃最后一位字节。

7.查询某一天以后的数据.能够用and添加条件

select * from t_name t where t.update_date > to_date('2017-11-01 20:00:00','yyyy-MM-dd HH24:MI:SS')

8.like搜索某种模式

9.查询多字段重复数据

select * from t_name t where (t.userid) in (select userid from t_name group by userid having count(*) > 1)

10.删除重复数据

delete from t_name t where (t.userid) in (select userid from t_name group by userid having count(*) > 1)

 

desc:降序排列

asc:升序排列

相关文章
相关标签/搜索