Professional Documents
Culture Documents
Queries 23.10.17
Queries 23.10.17
Queries 23.10.17
============
SQL> startup
ORACLE instance started.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@localhost ~]$ ps -ef|grep pmon
ora11g 4934 1 0 12:44 ? 00:00:00 ora_pmon_genconf
oracle 5061 4836 0 12:46 pts/2 00:00:00 grep pmon
[oracle@localhost ~]$ sqlplus / as sysdba
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> !id
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba)
INSTANCE_NAME STATUS
---------------- ------------
genconf OPEN
14 rows selected.
6 rows selected.
SQL> select ename,job,sal from emp where sal between 2000 and 3000;
SQL> select ename,job,sal from emp where sal between 2000 and 3000 order by sal
asc;
LOSAL
----------
700
1201
1401
2001
3001
SQL> select losal from salgrade where losal between 500 and 3000 order by losal
desc;
LOSAL
----------
2001
1401
1201
700
LOSAL
----------
3001
2001
1401
1201
700
56 rows selected.
14 rows selected.
SQL>
SQL>
SQL>
SQL> desc emp;
Name Null? Type
----------------------------------------- -------- ----------------------------
EMPNO NOT NULL NUMBER(4)
ENAME VARCHAR2(10)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO NUMBER(2)
14 rows selected.
9 rows selected.
COUNT(*)
----------
14
SQL> select * from emp where sal between 2000 and 3000;
5 rows selected.
1 row selected.
SUM(SAL)
----------
29025
1 row selected.
AVG(SAL)
----------
2073.21429
1 row selected.
2 rows selected.
SQL> select * from emp where hiredate< (select hiredate from emp where
job='PRESIDENT');
8 rows selected.
SQL>