Customers (ssNum, name, address)
Orders (ssNum, id)
Products (id, pprice, description)
a)
Select the names of all customers who have orders.
SELECT DISTINCT name
FROM Customers INNER JOIN Orders ON
Customers.ssNum = Orders.ssNum;
b)
Select all the products with the description “Phone” that have been ordered
SELECT DISTINCT Product s.*
FROM Orders INNER JOIN Products ON
Products.id = Order s.id
WHERE description = ‘Phone’;
c)
Select the addresses of the customers, who have ordered products worth more than 800, and the related product info.
SELECT DISTINCT c.address, p.*
FROM Customers c INNER JOIN Orders o ON c.ssNum = o.ssNum
INNER JOIN Products p ON o.id = p.id
WHERE pprice > 800;
Example of SQL Inner Join
·
Oracle SQL
Archives
-
▼
2010
(49)
-
▼
February
(49)
- Null Values in SQL Group By
- Examples of SQL Having & SQL Group By
- SQL Inline Views
- SQL Join View
- Modifying SQL Views (Insert, Update and Delete on ...
- SQL Scalar subquery
- SQL Correlated Subquery
- SQL Inline View Subquery
- Examples of Oracle PL/SQL Cursors
- Oracle PL/SQL WHERE CURRENT OF & FOR UPDATE
- Oracle PL/SQL REF Cursors
- Oracle PL/SQL Cursors With Parameters
- Oracle PL/SQL Cursor For Loops
- Oracle PL/SQL Explicit Cursors
- Oracle PL/SQL Implicit Cursors
- PL/SQL Programmer Defined Records
- PL/SQL Cursor Based Records
- PL/SQL Table Based Records
- Oracle PL/SQL Nested Tables
- Oracle PL/SQL Varrays
- Oracle PL/SQL Tables
- Oracle PL/SQL Records
- SQL PL/SQL Interview Questions
- PL/SQL Triggers
- Oracle PL/SQL Cursors
- PL/SQL Collections
- PL/SQL Introduction
- Join Using Multiple Tables (more than 2)
- SQL Equi-join
- SQL Cross Join
- Example of SQL Self Join
- SQL Self Join
- Example of SQL Inner Join
- SQL Inner Join/ SQL Natural Join:
- Example of SQL Outer Join
- SQL Outer Join
- Example of Simple SQL Join
- SQL Interview Questions
- SQL Views
- SQL Subqueries
- SQL Having
- SQL Group By Examples
- SQL Group By
- SQL Joins
- SQL Delete
- SQL Update
- SQL Insert
- SQL Syntax
- SQL Introduction
-
▼
February
(49)