Oracle Database Getting started with Oracle Database

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Remarks

Oracle is a relational database management system (RDBMS) originally built by Larry Ellison, Bob Miner, and Ed Oates in the late 70s. It was intended to be compatible with IBM's System R.

Versions

VersionRelease Date
Version 1 (unreleased)1978-01-01
Oracle V21979-01-01
Oracle Version 31983-01-01
Oracle Version 41984-01-01
Oracle Version 51985-01-01
Oracle Version 61988-01-01
Oracle71992-01-01
Oracle81997-07-01
Oracle8i1999-02-01
Oracle9i2001-06-01
Oracle 10g2003-01-01
Oracle 11g2007-01-01
Oracle 12c2013-01-01

Hello World

SELECT 'Hello world!' FROM dual;
 

In Oracle's flavor of SQL, "dual is just a convienence table". It was originally intended to double rows via a JOIN, but now contains one row with a DUMMY value of 'X'.

Hello World from PL/SQL

/* PL/SQL is a core Oracle Database technology, allowing you to build clean, secure, 
   optimized APIs to SQL and business logic. */

set serveroutput on 

BEGIN
   DBMS_OUTPUT.PUT_LINE ('Hello World!');
END;
 

Hello world! from table

Create a simple table

create table MY_table (
   what varchar2(10), 
   who varchar2(10), 
   mark varchar2(10)
);
 

Insert values (you can omit target columns if you provide values for all columns)

insert into my_table (what, who, mark) values ('Hello', 'world', '!' );
insert into my_table values ('Bye bye', 'ponies', '?' );
insert into my_table (what) values('Hey');
 

Remember to commit, because Oracle uses transactions

commit;
 

Select your data:

select what, who, mark from my_table where what='Hello';
 

SQL Query

List employees earning more than $50000 born this century. List their name, date of birth and salary, sorted alphabetically by name.

SELECT employee_name, date_of_birth, salary
FROM   employees
WHERE  salary > 50000
   AND date_of_birth >= DATE '2000-01-01'
ORDER BY employee_name;
 

Show the number of employees in each department with at least 5 employees. List the largest departments first.

SELECT department_id, COUNT(*)
FROM   employees
GROUP BY department_id
HAVING COUNT(*) >= 5
ORDER BY COUNT(*) DESC;
 


Got any Oracle Database Question?