Oracle SQL and Oracle SQL*Plus
SQL and SQL*Plus The most efficient way to look at information in a table is with a query, and the most efficient way to write a query is with the SQL language.
SQL was created by IBM in the mid-1970s as a front-end query language for relational databases.
SQL - sometimes pronounced 'sequel' - stands for Structured Query Language.
SQL is a powerful 'English-like' language which consists of a relatively few commands.
SQL is the ANSI standard for the manipulation, definition, and control of data.
Oracle Corporation was the first company to offer a commercial version of SQL with the Oracle database in 1979.
Examples of SQL statements:
SELECT stock_number, manufact_code, description, unit_price
FROM stock
WHERE description = ‘Smoked Meat’;
SELECT stock_number, stock.manufact_code, manufact_name, description
FROM stock, manufact
WHERE stock.manufact_code = manufact.manufact_code;
INSERT into contractors
VALUES ('Jennifer','Blair','Oracle Instructor');
UPDATE employees
SET last_name = 'Hollar'
WHERE first_name = 'Sharon' and last_name = 'Anderson';
CREATE TABLE employees
(emp_id NUMBER(6),
fname VARCHAR2(15),
lname VARCHAR2(15),
date_hired DATE,
dept_code VARCHAR2(5),
rate NUMBER( 4,2) );
Oracle SQL SELECT Statement
The SELECT statement is the basis of all queries in SQL. This is commonly known as querying the database.
Syntax
Just as spoken language has syntax rules concerning the way we use words in sentences, SQL*Plus has syntax rules that govern how you use SQL commands.
You must follow these rules if you want SQL*Plus to accept and execute your commands.
The syntax of the SELECT statement is:
SELECT column-list
FROM table-name
[WHERE condition]
[GROUP BY column-list]
[HAVING condition]
[ORDER BY column-name [DESC]
Only the SELECT and FROM clauses of the statement are always required; all the other clauses are used when you want a more specific out come than a simple select will give you.
However, take note that when using a combination of the optional clauses, they must appear in the order shown above.
Oracle SQL and the Importance of Order of Precedence