Oracle语句

1、使用过的

--备份表
	create bak_TB_student as select * from TB_student;
--清空表
	truncate table TB_student;
	delete TB_student
--删除表
	drop table TB_student;
--排序
	select * from TB_student order by m_age desc;
--根据日期进行删除
	delete from TB_student where m_time
		between to_date('1996-10-10 00:00:00','YYYY-MM-DD HH24:MI:SS
		and to_date('2020-10-10 00:00:00','YYYY-MM-DD HH24:MI:SS');
--添加字段
	alter table TB_student add(m_time);
--去重查询
	select distinct m_time from TB_student order by m_time desc;
	select distinct m_time,m_age from TB_student order by m_time desc;


--查找所有表名是以'TB'开头的,并且倒叙排序
SELECT table_name FROM user_tables
	WHERE table_name like 'TB%'		--%代表任意多个字符		_代表任意一个字符
	ORDER BY table_name DESC

--模糊查询like
select * from TB_student
	where m_name like 'xiaomin'
	and m_age like '%%'
	and m_birthday like TO_DATA(:l_data, 'YYYY-MM-DD')

  

posted @ 2019-02-14 21:40  雪落梅藏  阅读(121)  评论(0编辑  收藏  举报