Table of Contents
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Home Database Mysql Tutorial 【顶点实习】oracle的学习 二

【顶点实习】oracle的学习 二

Jun 07, 2016 pm 03:39 PM
oracle study vertex master

2012/12/19 23:08 by 灵月 (ps:高手请路过,新手可一笑而过 ) 授课老师:林嵩 教授内容: SQL基础 1.了解什么是SQL语句 2.了解SQL语句关于表的操作 3.掌握SQL语句的查询命令 4.掌握SQL常用函数 5.掌握SQL语句对于数据表中记录的操作 6.了解数据库的其它对象

2012/12/19 23:08 by 灵月
(ps:高手请路过,新手可一笑而过【顶点实习】oracle的学习 二)

授课老师:林嵩

教授内容:

SQL基础

1.了解什么是SQL语句

2.了解SQL语句关于表的操作

3.掌握SQL语句的查询命令

4.掌握SQL常用函数

5.掌握SQL语句对于数据表中记录的操作

6.了解数据库的其它对象:视图、序列、索引,同义词

7.解数据库权限分配

个人学习情况:

今天真是够快的,这对于我这个刚接触oracle的菜鸟够呛!【顶点实习】oracle的学习 二

记下几个课堂中自己不懂的知识点:

1.字符型日期插入’25-12月-01‘;

2.number(8,2)  123456.12 整数位只有6位;

3.char 与 varchar2的区别 这个从二方面理解,定长肯定是占资源,解析快,不定长 是占资源少,解析慢,各有千秋;

4.几个约束键:check 、default、unique;

5.to_char();

6.取消重复行 distinct

7.通配符 % _ 

8.escape  / 转义符

9.连接查询 (这个内容多)

学习 步步为营 博文一篇 http://blog.163.com/yuxiangtong0524@126/blog/static/8008616320103624845309/

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

ORACLE左右连接  

2010-04-06 14:48:45|  分类: Oracle |字号 订阅

1.【顶点实习】oracle的学习 二

 左连接  
  a.a=b.b(+)  
  右连接  
  a.a(+)=b.b  

2.【顶点实习】oracle的学习 二

  create   table   dali.test1(a   int,b   int);  
  create   table   dali.test2(a   int,b   int);  
   
  insert   into   dali.test1   values(1,456);  
  insert   into   dali.test1   values(2,427);  
  insert   into   dali.test2   values(1,45456);  
  insert   into   dali.test2   values(3,45656);  
   
  ---内连接  
  select   *   from   dali.test1   a,   dali.test2   b   where   a.a=b.a;  
   
  ---左连接  
  select   *   from   dali.test1   a,   dali.test2   b   where   a.a=b.a(+);  
   
  ---右连接  
  select   *   from   dali.test1   a,   dali.test2   b   where   a.a(+)=b.a;  
   
  ---完全连接  
  select   *   from   dali.test1   a,   dali.test2   b   where   a.a=b.a(+)  
  union  
  select   *   from   dali.test1   a,   dali.test2   b   where   a.a(+)=b.a;  
   
  ---迪卡尔  
  select   *   from   dali.test1,   dali.test2;


3.数据表的连接有:
1、内连接(自然连接): 只有两个表相匹配的行才能在结果集中出现
2、外连接: 包括
(1)左外连接(左边的表不加限制)
(2)右外连接(右边的表不加限制)
(3)全外连接(左右两表都不加限制)
3、自连接(连接发生在一张基表内)
select a.studentno, a.studentname, b.classname
  from students a, classes b
  where a.classid(+) = b.classid;
STUDENTNO STUDENTNAM CLASSNAME
---------- ---------- ------------------------------
    1 周虎     一年级一班
    2 周林     一年级二班
    3              一年级三班
以上语句是右连接:
即"(+)"所在位置的另一侧为连接的方向,右连接说明等号右侧的所有
记录均会被显示,无论其在左侧是否得到匹配。也就是说上例中,无
论会不会出现某个班级没有一个学生的情况,这个班级的名字都会在
查询结构中出现。
反之:
select a.studentno, a.studentname, b.classname
  from students a, classes b
  where a.classid = b.classid(+);
STUDENTNO STUDENTNAM CLASSNAME
---------- ---------- ------------------------------
    1 周虎     一年级一班
    2 周林     一年级二班
    3 钟林达
则是左连接,无论这个学生有没有一个能在一个班级中得到匹配的部门号,
这个学生的记录都会被显示。
select a.studentno, a.studentname, b.classname
  from students a, classes b
  where a.classid = b.classid;
这个则是通常用到的内连接,显示两表都符合条件的记录
总之,
左连接显示左边全部的和右边与左边相同的
右连接显示右边全部的和左边与右边相同的
内连接是只显示满足条件的! ...... 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

10.学习视图时遇到个小问题,关于scott无权限建立view视图的,百度解决

引 piranha博文一篇 http://piranha.iteye.com/blog/847877

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

在创建用户的时候如果直接给用户DBA权限,那么在B用户中可以直接查询A用户的表,但是在创建视图时就会报无权限,在这种情况下需要再在被访问的A用户里面去给予要访问该表的B用户授权。

--创建视图权限,一般网上找都是说的这句,但是光有这句还是无法创建
grant create  view to B;

--授予查询权限
grant select any table to B;

--授予权限
grant select any dictionary to B;


以上3项地后就能正常创建视图了。

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

时间比较晚,赶紧收拾下睡觉!【顶点实习】oracle的学习 二


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What to do if the oracle can't be opened What to do if the oracle can't be opened Apr 11, 2025 pm 10:06 PM

Solutions to Oracle cannot be opened include: 1. Start the database service; 2. Start the listener; 3. Check port conflicts; 4. Set environment variables correctly; 5. Make sure the firewall or antivirus software does not block the connection; 6. Check whether the server is closed; 7. Use RMAN to recover corrupt files; 8. Check whether the TNS service name is correct; 9. Check network connection; 10. Reinstall Oracle software.

How to delete all data from oracle How to delete all data from oracle Apr 11, 2025 pm 08:36 PM

Deleting all data in Oracle requires the following steps: 1. Establish a connection; 2. Disable foreign key constraints; 3. Delete table data; 4. Submit transactions; 5. Enable foreign key constraints (optional). Be sure to back up the database before execution to prevent data loss.

How to solve the problem of closing oracle cursor How to solve the problem of closing oracle cursor Apr 11, 2025 pm 10:18 PM

The method to solve the Oracle cursor closure problem includes: explicitly closing the cursor using the CLOSE statement. Declare the cursor in the FOR UPDATE clause so that it automatically closes after the scope is ended. Declare the cursor in the USING clause so that it automatically closes when the associated PL/SQL variable is closed. Use exception handling to ensure that the cursor is closed in any exception situation. Use the connection pool to automatically close the cursor. Disable automatic submission and delay cursor closing.

How to paginate oracle database How to paginate oracle database Apr 11, 2025 pm 08:42 PM

Oracle database paging uses ROWNUM pseudo-columns or FETCH statements to implement: ROWNUM pseudo-columns are used to filter results by row numbers and are suitable for complex queries. The FETCH statement is used to get the specified number of first rows and is suitable for simple queries.

How to create cursors in oracle loop How to create cursors in oracle loop Apr 12, 2025 am 06:18 AM

In Oracle, the FOR LOOP loop can create cursors dynamically. The steps are: 1. Define the cursor type; 2. Create the loop; 3. Create the cursor dynamically; 4. Execute the cursor; 5. Close the cursor. Example: A cursor can be created cycle-by-circuit to display the names and salaries of the top 10 employees.

How to stop oracle database How to stop oracle database Apr 12, 2025 am 06:12 AM

To stop an Oracle database, perform the following steps: 1. Connect to the database; 2. Shutdown immediately; 3. Shutdown abort completely.

How to create oracle dynamic sql How to create oracle dynamic sql Apr 12, 2025 am 06:06 AM

SQL statements can be created and executed based on runtime input by using Oracle's dynamic SQL. The steps include: preparing an empty string variable to store dynamically generated SQL statements. Use the EXECUTE IMMEDIATE or PREPARE statement to compile and execute dynamic SQL statements. Use bind variable to pass user input or other dynamic values ​​to dynamic SQL. Use EXECUTE IMMEDIATE or EXECUTE to execute dynamic SQL statements.

How to open a database in oracle How to open a database in oracle Apr 11, 2025 pm 10:51 PM

The steps to open an Oracle database are as follows: Open the Oracle database client and connect to the database server: connect username/password@servername Use the SQLPLUS command to open the database: SQLPLUS

See all articles