Oracle SQL Tutorial

sql_icon_by_raisch-d3ax2ihOracle products use SQL, the industry standard relational database language that was defined by IBM Research but was first introduced to the commercial market by Oracle Corporation in 1979. Oracle SQL is used to manipulate and query data stored in Oracle databases.

Oracle Database

  • Some databases have minimum features and only store data, while Oracle includes programming languages, facilities, and utilities that support enterprise-level applications and data warehousing. Oracle is one of the most popular databases in the world.

    As a Relational Database Management System (RDBMS), Oracle stores data in tables with rows and columns. A table is referred to as a collection of objects of the same type (rows). The basis for the term relational database is that data in a table can be related according to common keys, concepts, and the ability to retrieve related data from a table. Data is accessed through SQL, or Structured Query Language.

SQL

  • Oracle supports SQL commands that allow you to select your data, insert new records, update existing records and delete records you want to discard.

    The most common SQL operation is the select command. The select clause is always followed by the from clause:

    SELECT column name FROM table name;

    Before you can select data from your database you must insert data into a table. In the create table command, first you tell Oracle what you want to name your table; next you specify the names of the columns of your table and the type of data that each column is to contain:

    CREATE TABLE table name (first column name NUMBER (2), second column name CHAR (14), third column name CHAR (13));

    The first column contains numeric data (NUMBER), and the second and third columns contain character data (CHAR)—letters, numbers or punctuation marks, etc. The numbers represent the maximum length of values that can be stored in your columns.

    Once you have created a table you can begin entering rows of data by issuing the insert command, then list the data values that are to go into each column:

    INSERT INTO table name VALUES (30, ‘name’, ‘address’);

    The update clause names the table you want to modify. The set clause “sets” the field you name equal to some value. The update command changes values stored in fields:

    UPDATE table name SET field name = field name + 100

    The DELETE FROM clause names the table from which you want to remove a row or set of rows. The WHERE clause is optional and would mean that you wanted to remove all the rows from a table and specify the conditions under which your rows are to be deleted:

    DELETE FROM table name WHERE table name = 40

    Large or complex SQL statements (stored procedures) need to be written in Oracle’s PL/SQL (Procedural Language/Structured Query Language) code, which is the execution of several SQL statements.

Leave a Reply