首页 > 数据库 >oracle-视图

oracle-视图

时间:2023-10-24 10:13:50浏览次数:39  
标签:read 视图 查询 dept only oracle view

视图

视图是一个虚拟表,其内容由查询定义。同真实的表一样,视图包含一系列带有名称的列和行数据。但是,视图并不在数据库中以存储的数据值集形式存在。行和列数据来自由定义视图的查询所引用的表,并且在引用视图时动态生成的。

视图是oracle又一个数据对象,其主要作用是简化操作,提高安全,满足不同用户的查询需求,视图不是一个真正存在的物理表,它是根据别的表动态生成的。

 

n  视图与表的区别

①表需要占用磁盘空间,视图不需要

②视图不能添加索引

③使用视图可以简化复杂查询,比如:学生选课系统

④视图有利于提高安全性,比如:不同用户查看不同视图

 

n  创建视图

create view 视图名 as  select 语句 [with read only]

 

n  创建或修改视图

create or replace view 视图名 as  select语句 [with read only]

 

n  删除视图

drop view 视图名

 

视图可以简化操作,比如:我们希望查询雇员的名字和部门编号和部门名称,

传统:查询两张表

视图简化:create or replace view myview as select emp.ename,dept.deptno,dept.dname from emp,dept where emp.deptno=dept.deptno with read only;

View created

标签:read,视图,查询,dept,only,oracle,view
From: https://www.cnblogs.com/xupengxiang/p/17784079.html

相关文章

  • oracle打开/关闭归档日志ARCHIVELOG
    1.使用SQLPlus登录用户名:sqlplus密码:assysdba 2.查询数据库是否是归档模式:查询结果为“ARCHIVELOG”表示数据库为归档模式SELECTlog_modeFROMv$database;3.关闭数据库shutdownimmediate;4.启动数据库mount模式startupmount;5.启动归档日志alte......
  • oracle数据库启停
    使用oracle登录//停止1.ps-ef|grepsmon2.exportORACLE_SID=cbsdba(这是实例名字)3.sqlplus/assysdba 4.shutdown immediate;//启动1.ps-ef|grepsmon2.exportORACLE_SID=cbsdba3.sqlplus/assysdba 4.startup;5.alter pluggabledatabaseallopen;......
  • Oracle中通过组内排序实现行转列(三)
    1纵表平铺1.1原数据 1.2平铺结果:每个班级按照年龄从小到大平铺为一行select*from(selectrt.class,row_number()over(partitionbyrt.classorderbyrt.age)row_num,rt.sno,rt.snamefromrank_tes......
  • Linux平台下Oracle数据泵备份(expdp)SHELL脚本
    数据泵是Oracle10g的新特性,10g以后的版本才有。关于数据泵的理论知识参考我的Blog:Oracle10gEXPDP和IMPDP使用说明http://www.cndba.cn/Dave/article/1115 Logicalbackup.sh#!/bin/ksh#####################################################################......
  • Oracle10gOCP042题库121166题共168题
    121.Youwanttocreateanewoptimizeddatabaseforyourtransactionalproductionenvironmenttobeusedbyafinancialapplication.Whilecreatingthedatabase,youwanttheOraclesoftwaretotakecareofallbasicsettingstooptimizethedatabasep......
  • Oracle10gOCP042题库130题共168题
    声明:对于答案的相关的说明,是个人对Oracle的理解。1.Becauseofapoweroutage,instancefailurehasoccurred.Fromwhatpointintheredologdoesrecoverybeginandwheredoesitend?A.CurrentredologandinactiveredologB.Checkpointpositiontoendofr......
  • Oracle10gOCP042题库3170题共168题
    31.WhichtwostatementsaretrueregardingthedatabaseinARCHIVELOGmode?(Choosetwo.) A)Youhavetoshutdownthedatabasetoperformthebackups. B)Archivinginformationiswrittentothedatafilesandredologfiles. C)Youcanperformcomp......
  • Oracle10gOCP042题库71120题共168题
    71.Yourdatabaseinstanceisstartedusingtheserverparameterfile(SPFILE).Controlfilesaremultiplexedandstoredondifferentdisks.Becauseofadiskfailure,youlostoneofthesecontrolfiles.Youreplacedthedamageddisk.Whatisthecorre......
  • mysql,sqlserver,oracle各自的存在更新不存在添加写法
    mysql,sqlserver,oracle各自的存在更新不存在添加写法在向表中插入数据的时候,经常遇到这样的情况:首先判断数据是否存在;如果不存在,则插入:如果存在,则更新。SQLserver脚本先查询,没有数据再进行数据插入,有数据就走更新ifnotexists(select1fromtwhereid=1)ins......
  • Oracle数据库表空间和角色/用户 权限
    问题1.2.3.https://www.iteye.com/blog/czmmiao-1304934这个特别好4.5.6.https://www.51cto.com/article/158937.html表空间7.创建用户8.表空间9.oracle体系结构详解10.https://zhuanlan.zhihu.com/p/100390025实例、表空间、用户之间的关系11.https://docs.oracle......