oracle---概括01

1.oracle与mysql的区别

1.1:类型

  oracle只有三种类型:varchar;  date;  number;

  mysql类型:so many;

1.2:oracle的分页语句

1.3:group by 子句

1.4:序列:(oracle没有主键自增)

2.oracle:

a.连接字符:||    ......>select ename ||‘`s salary is:‘||sal from emp

  显示:

      oracle---概括01

b.关系运算符:b1:select * from emp where sal between 1600 and 3000;  b2:select * from emp where sal in (1600,1250,1500)

c.空值判断:c1:select * from emp where comm is null;  c2:select * from emp where comm is not null

d:模糊查询:d1:select * from emp where ename like ‘_L%‘  d2:注意:当查询的语段里出现“_”等特殊字段,需要添加转义字符;如:

    select * from emp where ename like ‘_%‘   escape ‘@‘;

    escape:申请转义字符;

e:时间的转换:

  e1:将时间类型转换为字符串类型:SQL> select * from emp where to_char(hiredate,‘yyyy/MM/dd‘)= ‘1980/12/17‘;

  e2:将字符串类型转换为时间类型:SQL> select * from emp where hiredate= to_date(‘1980/12/17‘,‘yyyy/MM/dd‘);

f:排序:

  f1:升序:SQL> select * from emp where sal between 1600 and 6000 order by sal asc;

  f2:降序:SQL> select * from emp where sal between 1600 and 6000 order by sal desc;

例题1:显示不带“R”的员工的姓名:

oracle---概括01

例题2:显示姓名字段的如何位置包含‘A’的所有员工的姓名,显示的结构按照基本工资由高到低排序,

  如果按照基本工资相等,则按照雇佣关系的早晚;

oracle---概括01

相关推荐