Oracle常用语句

Posted on   Erica_W  阅读(6)  评论(0编辑  收藏  举报
1.查询所有数据库
由于Oralce没有库名,只有表空间,所以Oracle没有提供数据库名称查询支持,只提供了表空间名称查询。
select * from v$tablespace;    --查询表空间(需要一定权限)
 
2.查询当前数据库中所有表名
select * from user_tables;
 
3.查询指定表中的所有字段名
select column_name from user_tab_columns where table_name = 'table_name';    --表名要全大写
 
4.查询指定表中的所有字段名和字段类型
select column_name, data_type from user_tab_columns where table_name = 'table_name';    --表名要全大写
 
5.查询当天创建的数据
select * from [表名] t where TO_CHAR(t.createdtime,'yyyy-MM-dd') = TO_CHAR(sysdate,'yyyy-MM-dd');
 
6.备份数据
create table [备份名] as select * from [表名];
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
· 如何调用 DeepSeek 的自然语言处理 API 接口并集成到在线客服系统
点击右上角即可分享
微信分享提示