oracle基本笔记整理

        oracle,简单来说就是数据库,数据库 ,顾名思义,就是存放数据的容器!!

不知道oracle的我先科普一下吧~~~科普,科学普及简称科普,又称大众科学或者普及科学,是指利用各种传媒以浅显的、让公众易于理解、接受和参与的方式向普通大众介绍自然科学和社会科学知识、推广科学技术的应用、倡导科学方法、传播科学思想、弘扬科学精神的活动。

        nice,科普完毕,接下来废话不多说了,直接上代码案例,前人说:脑子是个好东西,得用起来!!!后人补充到:古人说的对!!!

select * from scott.emp;
select eName from scott.emp;
select rowid,ename from scott.emp where ename='SMITH';
select emp.*,rownum from scott.emp where rownum<11;--创建学员信息表
create table student
(
stuNo char(6) not null,
stuName varchar2(20) not null,
stuAge number(3,0) not null,
stuID number(18,0),
stuSeat number(2,0)
);insert into stuinfo(stuNo,stuname,stuAge,stuSeat)values('2','活动',25,3)
select * from stuinfo--查询表的位置
select tablespace_name,table_name from user_tables where table_name=upper('stuinfo');--创建表空间
create tablespace test 
datafile 'D:\oracle\shujuku\test.ora' 
size 1000M;
create user test identified by test default tablespace test  quota 500M on users;
grant all privileges to test;--查看表空间
select file_name,tablespace_name,bytes,autoextensible from dba_data_files where tablespace_name='test';select * from test.stuinfo;--提交事务
commit;
select * from scott.emp;--修改密码
alter user system identified by 123;select * from scott.emp;
--rowid伪列数据对象编号  文件编号  块编号  行编号  
select e.*,rowid from scott.emp e;
--rownum,从1开始,大于1的东西查不出来,小于等于某个值可以查询
select e.*,rownum from scott.emp e where rownum<=10;
select * from scott.dept;
insert into scott.dept(deptno,dname,loc)values('5','1111','dsds'); 
commit;delete from scott.dept where deptno='5' ;commit;----创建学员信息表
create table student
(
stuNo number not null,
stuName varchar2(20) not null,
stuAge number(3,0) not null,
stuSeat number(2,0)
);
select * from studentinsert into student(stuNo,stuname,stuAge,stuSeat)values('1','张三',18,1);
insert into student(stuNo,stuname,stuAge,stuSeat)values('2','李四',20,2);
insert into student(stuNo,stuname,stuAge,stuSeat)values('3','王五',15,3);
insert into student(stuNo,stuname,stuAge,stuSeat)values('4','张三',18,4);
insert into student(stuNo,stuname,stuAge,stuSeat)values('5','张三',20,5);--事务的处理
--没有添加进去编号8
insert into student(stuNo,stuname,stuAge,stuSeat)values('6','王五1',12,6);
insert into student(stuNo,stuname,stuAge,stuSeat)values('7','张三1',14,7);
savepoint a;
insert into student(stuNo,stuname,stuAge,stuSeat)values('8','张三',20,5);
rollback to savepoint a;
commit;
select * from test.student;--选择无重复的行distinct
select distinct stuname from student;--选择重复的行distinct(姓名和年龄)
select distinct stuname ||stuage from student;/*
注释的重要性
*/
--别名
select distinct stuname "姓名"  from student;--复制一个表 as后边加一个select 
create table newstudent1 as select * from student;
select * from newstudent1 ; 
--复制表的结构(不包括数据)
create table newstudent as select * from student where 1=2;
select * from newstudent;--查询表中的记录数
select count(1) from student;--查询姓名和年龄中不存在重复的记录 
--大于等于是查询重复的,小于是查询不重复的
select stuname,stuage from student group by stuname,stuage having(count(stuname||stuage)<2);
select stuname,stuage from student group by stuname,stuage having(count(stuname||stuage)>1);
select stuname from student group by stuname having(count(stuname)<5);--查询用户数量大于10的
select * from user_all_tables a where a.num_rows>1;--添加列,删除列
alter table student add(phone varchar2(20),emil varchar2(20));
alter table student drop(phone);
select * from student;select * from stuinfo;
select stuname from student group by stuname having(count(stuname)>1);/*
oracle的日期函数last_day 意思是得到每月的最后一天,用这个函数,我们可以得到各种不同的日期.
1:得到当前月第一天与最后一天
*/
select
to_char(trunc(sysdate,'MONTH'),'yyyymmdd')firstday
, to_char(last_day(trunc(sysdate,'MONTH')),'yyyymmdd') lastdayfrom dual;--2:得到上月第一天与上月最后一天
SELECT to_char( last_day(add_months(SYSDATE, -2)) + 1 ,'yyyymmdd') firstday
,to_char(last_day(add_months(SYSDATE, -1)),'yyyymmdd') 
lastday 
FROM dual;
--3:得到上上个月第一天与上上个月最后一天
SELECT
to_char( last_day(add_months(SYSDATE, -3)) + 1 ,'yyyymmdd') 
firstday
,to_char(last_day(add_months(SYSDATE, -2)),'yyyymmdd')lastday 
FROM dual;
--4:得到下个月第一天与下个月最后一天
SELECT to_char( last_day(add_months(SYSDATE, 0)) + 1 ,'yyyymmdd') 
firstday
,to_char(last_day(add_months(SYSDATE, 1)),'yyyymmdd')lastday 
FROM dual;

       nice,有的人可能之前没学过数据库,比如说my sql ,sql server 等等,直接上来就是oracle,所以,推荐一部视频,即使你没有学过sql server什么的,或者学过没深入理解的,那么,请点击 这里, 密码: 3ydr,一共46节课,足足够你学会oracle了,拿走不谢!!!



本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/328084.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

不同范数下的余弦定理_第06题 | 从源头追溯「余弦定理」amp; 文理科知识点的异同...

文、理科数学大部分知识点、甚至相关知识点的考查形式都是共同的&#xff0c;甚至往年理科题目过几年就会出现在文科试卷上&#xff0c;反之亦然&#xff1b;「射影定理」是「余弦定理」的直接来源&#xff0c;所以不算超纲知识点。先发福利&#xff1a;这里有6场「高考数学」系…

ASP.NET CORE 项目实战 ---图形验证码的实现

简介   很长时间没有来更新博客了&#xff0c;一是&#xff0c;最近有些忙&#xff0c;二是&#xff0c;Core也是一直在摸索中&#xff0c;其实已经完成了一个框架了&#xff0c;并且正在准备在生产环境中试用&#xff0c;但是很多东西也是出于自己理解的肤浅和技术的不断更新…

vue.js 接收url参数

转载自 vue.js 接收url参数1) 路由配置传参方式在配置路由时 例如 "/firewall/authorize/:uid/:uname/:token"页面url为 http://XXX.com/firewall/authorize/23/zhangman/232454 js 接收方式 this.$route.params.uid,2) ?传参方式例 http://XXX.com/firewall/auth…

在IDEA中将SpringBoot项目打包成jar包的方法 不要用 在上面有可以用的

在IDEA中将SpringBoot项目打包成jar包的方法 2018年03月07日 10:43:52 叶叶叶叶大爷 阅读数 71375 版权声明&#xff1a; https://blog.csdn.net/qq_37105358/article/details/79467401 SpringBoot项目无需依赖tomcat容器(内含)就可以发布,现在将打包步骤记录一下: 1. 打包前…

磁珠 符号_贴片磁珠功能_贴片磁珠应用

磁珠专用于抑制信号线、电源线上的高频噪声和尖峰干扰&#xff0c;还具有吸收静电脉冲的能力。磁珠是用来吸收超高频信号&#xff0c;像一些RF电路&#xff0c;PLL&#xff0c;振荡电路&#xff0c;含超高频存储器电路(DDRSDRAM&#xff0c;RAMBUS等)都需要在电源输入部分加磁珠…

跨平台的 NodeJS 组件解决 .NetCore 不支持 System.Drawing图形功能的若干问题

问题 生成缩略图生成验证码生成二维码给图片加水印 外部引用 Node 不解释 https://nodejs.org/en/download/sharp 高性能缩略图 https://github.com/lovell/sharpqr-image 二维码 https://github.com/alexeyten/qr-imagecaptchagen 验证码 https://github.com/contra/ca…

Vue动态路由匹配

转载自 动态路由匹配我们经常需要把某种模式匹配到的所有路由&#xff0c;全都映射到同个组件。例如&#xff0c;我们有一个 User 组件&#xff0c;对于所有 ID 各不相同的用户&#xff0c;都要使用这个组件来渲染。那么&#xff0c;我们可以在 vue-router 的路由路径中使用…

用IDEA把SpringBoot项目打成jar发布项目 不要用 在上面有可以用的

用IDEA把SpringBoot项目打成jar发布项目 2019年03月27日 11:08:51 小天努力学java 阅读数 235更多 所属专栏&#xff1a; SpringBoot学习 版权声明&#xff1a;本文为博主原创文章&#xff0c;未经博主允许不得转载。 https://blog.csdn.net/tian330726/article/details/8882…

oracle笔记整理2

--创建员工信息表 create table employee ( empno number(4) not null,--员工编号 ename varchar2(10), --员工姓名 job varchar2(9), --员工工种 mgr number(4), --上级经理编号 hiredate date, --受雇日期 sal number(7,2), --员工薪水 comm number(7,2…

lin通讯从节点同步间隔场_汽车行业必须知识--CAN FD通讯

前面我们讲了CAN的基础知识&#xff0c;但是由于CAN总线存在通讯速率低&#xff0c;报文头过长&#xff0c;刷新速率低等缺点。为解决这些问题CAN-FD应运而生。首先看看发展历史&#xff0c;2012年&#xff0c;BOSCH发布CAN FD white paper V1.0&#xff1b;2014&#xff0c;In…

ASP.NET Core loves JavaScript

前言 在 ASP.NET 团队的 Github 的主页上&#xff0c;有这样一个开源项目叫&#xff1a;“JavaScriptsServices”&#xff0c;那么什么是 JavaScriptsServices 呢&#xff1f; 它又有什么用呢&#xff1f; 下面就让我们一起来看一下吧。 什么是 JavascriptServices GitHub&…

npm 常用命令详解

转载自 【原】npm 常用命令详解今年上半年在学习gulp的使用&#xff0c;对npm的掌握是必不可少的&#xff0c;经常到npm官网查询文档让我感到不爽&#xff0c;还不如整理了一些常用的命令到自己博客上&#xff0c;于是根据自己的理解简单翻译过来&#xff0c;终于有点输出&…

阿里云服务器 window server tomcat启动 并且关闭window防火墙 配置8080端口开放还是没用

阿里云windows server 服务器开放端口 1.远程服务器关闭windows防火墙 不需要开放端口 2.阿里云管理平台开放指定的端口 如8081 阿里云服务器 window server tomcat启动 并且关闭window防火墙 配置8080端口开放还是没用 必须阿里云控制台开放指定的端口 不…

以ABP为基础架构的一个中等规模的OA开发日志

前言&#xff1a; 最近园子里ABP炒的火热。看了几篇对于ABP的介绍后&#xff0c;深感其设计精巧&#xff0c;实现优雅。个人感觉&#xff0c;ABP或ABP衍生品的架构设计&#xff0c;未来会成为中型Net项目的首选架构模式。如果您还不了解ABP是什么&#xff0c;有什么特色&#x…

vue 指令基本使用大全

转载自 vue 指令基本使用大全 指令 解释&#xff1a;指令 (Directives) 是带有 v- 前缀的特殊属性作用&#xff1a;当表达式的值改变时&#xff0c;将其产生的连带影响&#xff0c;响应式地作用于 DOM 常用指令 v-textv-htmlv-bindv-text 解释&#xff1a;更新元素的 textCon…

JAVA基础学习---Markdown

这里写自定义目录标题Markdown学习标题字体引用分割线图片超链接列表有序列表无序列表表格代码进退源代码模式Markdown学习 标题 加上空格是一级标题&#xff0c;二级标题是两个#加上空格&#xff0c;以此类推 字体 hello&#xff0c;world 前后各加两个*是粗体 hello&…

opencv立方体的画法_用opengl立方体的画法

/*** &#xff01; 使用该程序前须知 &#xff01;1.首先下载 glut-3[1].7.6.rar 压缩包2.解压后里面会有如下三个文件&#xff0c;把这三个文件分别放入 to 后的文件夹glut32.dll to C:\windows\System32glut32.lib to ..\..\VC98\lib 这个目录在VC6.0安装目录中可以找到glut.…

oracle基本笔记整理及案例分析1

/* Oracle数据库的应用 */--创建一个自动增长的表空间worktbs create tablespace worktbs datafile E:\E盘\worktbs01.dbf size 10M autoextend on;--删除表空间 --drop tablespace worktbs;--在表空间里面创建一个新用户 create user martin --用户名 identified b…

使用 JavaScriptService 在.NET Core 里实现DES加密算法

文章《ASP.NET Core loves JavaScript》和《跨平台的 NodeJS 组件解决 .NetCore 不支持 System.Drawing图形功能的若干问题》为我们扩展.NET Core的API提供了一套解决方案&#xff0c;上周在看.NET的加解密算法发现目前为止没有包括DES算法&#xff0c;github上在才刚刚加入&am…

电脑基本快捷键的使用

电脑快捷键 Tab键 等于六个空格 Alt键 Alt加上F4关闭当前窗口 Ctrl键 Ctrl加S保存 shift键 shift加delete永久性的删除(不会出现在回收站中) win win加E打开我的电脑 win加tab桌面多窗口预览,切换 其他 cmd打开命令行窗口 任务管理器结束进程后 cmd输入explorer可…