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

FROM CLAUSE



Oracle - From Clause


FROM clause is a mandatory clause in SELECT expression. It specifies the tables from which data is to be retrieved.


Syntax :
FROM table_name...  
Expressions...  

Oracle FROM Clause Example: (with one table)


Let's take an example to explain how to use FROM clause to retrieve data from one table. Consider 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
Pranav5687000Kerala

Execute this query:
SELECT *  
FROM customers  
WHERE salary >= 20000  
ORDER BY salary ASC;  

Output :

NAMEAGESALARYCITY
Sresta2123000Hyderabad
Pranvitha2125000Hyderabad
Nithya2125000Bangalore
Gauri2727000Hyderabad
Danush3131000Maharashtra
Pralayanath6576000Kerala
Pranavi6887000Kerala

Oracle FROM Clause Example: (with two tables)


Inner Join example:

Let's take two tables "suppliers" and "order1".


Suppliers:

Column_nameDatatypeNullableDefaultPrimarykey
Supplier_IDNUMBERyes--
Supplier_NameVARCHAR2(4000)yes--
Supplier_addressVARCHAR2(4000)yes--

Supplier_IDSupplier_NameSupplier_Address
1Bata shoesAgra
2KingfisherDelhi
3VOJOLucknow

Order1 :
Column_nameDatatypeNullableDefaultPrimarykey
Order_NumberNUMBERyes--
Supplier_IDNUMBERyes--
CityVARCHAR2(4000)yes--

Order_NumberSupplier_IDCity
1011Ahmedabad
1022Karnataka

Execute the following query:

SELECT suppliers.supplier_id, suppliers.supplier_name, order1.order_number  
FROM suppliers  
INNER JOIN order1  
ON suppliers.supplier_id = order1.supplier_id;  

OUTPUT :

Supplier_IDSupplier_NameOrder_number
1Bata Shoes101
2Kingfisher102


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