1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

Sql fundementals

Discussion in 'SQL PL/SQL' started by professional, Aug 8, 2008.

  1. professional

    professional Active Member

    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    80
    Hello

    Here's some (very) brief description about SQL

    SQL stands for Structured Query Language which is set of statements which deal with data in the database. Its divided into three main parts:

    DDL (data definiosion language)
    DML (data manipualtion language)
    DCL (data control Language)
     
  2. rajavu

    rajavu Forum Guru

    Messages:
    815
    Likes Received:
    52
    Trophy Points:
    610
    Location:
    @ Bangalore , India

    You can Have One more classification

    TCL - Transaction Control Language
     
  3. rajavu

    rajavu Forum Guru

    Messages:
    815
    Likes Received:
    52
    Trophy Points:
    610
    Location:
    @ Bangalore , India
    A brief explanation of the Structured Query Language types with examples as available from Orafaq wiki page :

    DDL - Data Definition Language: statements used to define the database structure or schema.

    Some examples:
    Code (Text):

    CREATE        - to create objects in the database
    ALTER          - alters the structure of the database
    DROP           - delete objects from the database
    TRUNCATE    - remove all records from a table, including all spaces allocated for the records are removed
    COMMENT    - add comments to the data dictionary
    RENAME       - rename an object
     
    DML - Data Manipulation Language: statements used for managing data within schema objects.

    Some examples:
    Code (Text):

    SELECT              - retrieve data from the a database
    INSERT              - insert data into a table
    UPDATE             - updates existing data within a table
    DELETE             - deletes all records from a table, the space for the records remain
    MERGE             - Merge operation
    CALL               - call a PL/SQL or Java subprogram
    EXPLAIN PLAN   - explain access path to data
    LOCK TABLE     - control concurrency
     
    DCL - Data Control Language:statements used to manage user access to an Oracle databas.

    Some examples:
    Code (Text):

    GRANT      - gives user's access privileges to database
    REVOKE    - withdraw access privileges given with the GRANT command
     
    TCL - Transaction Control Language: statements used to manage the changes made by DML statements. It allows statements to be grouped together into logical transactions.

    Some samples:
    Code (Text):

    COMMIT                 - save work done
    SAVEPOINT             - identify a point in a transaction to which you can later roll back
    ROLLBACK               - restore database to original since the last COMMIT
    SET TRANSACTION   - Change transaction options like isolation level and what rollback segment to use
     
    There has been a debate whether the 'SELECT is a DML statemnt or not' going for a long time , as SELECT doesn't 'Manipulate's the data but just Queries it. So as per some others there is another classification of SQL exclusively for the SELECT statement called DQL

    DQL - Data Query Language: statements used to query or retrieve the data from the Database . The only example is SELECT.

    .
     
  4. Arju

    Arju Forum Expert

    Messages:
    107
    Likes Received:
    5
    Trophy Points:
    240
    Location:
    Bangladesh
    Added more,
    System Control Statements

    These statements change the properties of the Oracle database instance. The only system control statement is ALTER SYSTEM. It lets users change settings, such as the minimum number of shared servers, kill a session, and perform other tasks.

    Embedded SQL Statements
    These statements used in a procedural language program, such as those used with the Oracle precompilers. Examples include OPEN, CLOSE, FETCH, and EXECUTE.