ORACLE
ORACLE CLAUSES
DISTINCT
FROM
ORDER BY
GROUP BY
HAVING
ORACLE TUTORIAL
Oracle Introduction
What Is Oracle
ORACLE TABLES
Create Tables
Create Table As
Alter Table
Drop Table
Global Temorary Tables
Local Temorary Tables
ORACLE VIEWS
Create View
ORACLE QUERIES
SELECT
INSERT
INSERT ALL
UPDATE
DELETE
TRUNCATE TABLE
ORACLE OPERATORS
UNION
UNION ALL
INTERSECT
MINUS
ORACLE JOINS
INNER JOIN
OUTER JOIN
EQUI JOIN
SELF JOIN
CROSS JOIN
ANTI JOIN
SEMI JOIN
ORACLE ADVANCE
PROCEDURES
FUNCTION
CURSOR
TRIGGER

DISTINCT



Oracle - Distinct


In Oracle, DISTINCT clause is used to remove the duplicate records from the result set. It is only used with SELECT statement.


Syntax:
SELECT DISTINCT expressions  
FROM tables  
WHERE conditions;  

Parameters :

  • expressions:It specifies the columns that you want to retrieve.

  • tables: It specifies the table from where you want to retrieve records. conditions: It specifies the conditions that must be fulfilled.


    Oracle DISTINCT Example: (with single expression)


    Let's take a table "customers"

    Customer table:

    CREATE TABLE  "CUSTOMERS"   
       (    "NAME" VARCHAR2(4000),   
        "AGE" NUMBER,   
        "SALARY" NUMBER,   
        "STATE" VARCHAR2(4000)  
       )  
    /  
    

    NameAgeSalaryCity
    Seethu1612000Bangalore
    Nithya2125000Bangalore
    Sanvika2656000Bangalore
    Pranvitha2125000Hyderabad
    Sresta2123000Hyderabad
    Gauri2727000Hyderabad
    Danush3131000Maharashtra
    Pralaynath6576000Kerala
    Pranav6887000Kerala

    Execute this query:
    SELECT DISTINCT state  
    FROM customers  
    WHERE name = 'Sresta';
    

    Output :
    CITY
    Hyderabad

    Oracle DISTINCT Example: (with multiple expressions)


    Execute this query:
    SELECT DISTINCT name, age, salary  
    FROM customers  
    WHERE age >= '60';
    

    Output :
    nameagesalary
    Pralaynath6576000

    This example specifies distinct name, age and salary of the customer where age is greater than or equal to 65.



    What Is Oracle

    What Is Oracle

    posted on 2019-11-29 01:11:21 - ORACLE Tutorials


    TRIGGER

    ORACLE - Trigger

    posted on 2019-11-28 22:14:22 - ORACLE Tutorials


    CURSOR

    ORACLE - Cursor

    posted on 2019-11-28 22:13:54 - ORACLE Tutorials


    MySQL TRIGGERS

    MySQL - Triggers

    posted on 2019-11-29 21:44:07 - mysql Tutorials


    Grant_ Revoke Privilege

    MySQL - Grant_ Revoke Privilege

    posted on 2019-11-26 23:15:04 - mysql Tutorials


    MySQL Vs SQL

    MySQL Vs SQL

    posted on 2019-11-25 05:02:26 - mysql Tutorials