Update for 03-03-22 22:00
This commit is contained in:
parent
6d12e3e5c1
commit
c3407617c5
@ -109,6 +109,26 @@ grouping totals based upon some other row.
|
||||
|
||||
`SELECT Team, COUNT(*) FROM Players GROUP BY Team`
|
||||
|
||||
=== JOIN ===
|
||||
|
||||
`JOIN` allows two tables to be returned together, where they are 'joined' upon
|
||||
a shared field.
|
||||
|
||||
{{{
|
||||
SELECT Orders.ID, Customers.Name, Orders.Name
|
||||
FROM Orders
|
||||
INNER JOIN Customers ON Orders.CustomerId=Customers.Id
|
||||
}}}
|
||||
|
||||
There are four types of joins
|
||||
* `INNER JOIN` returns all records that having matching records in both tables
|
||||
* `LEFT OUTER JOIN` returns all records from the left (Orders in above example)
|
||||
table, and the matched records from the right table
|
||||
* `RIGHT OUTER JOIN` returns all records from the right (Customers in above
|
||||
example) table, and the matched records from the left table
|
||||
* `FULL OUTER JOIN` returns all records when there is a match in either the
|
||||
left or right table
|
||||
|
||||
== Views ==
|
||||
|
||||
A view can be created with the following command
|
||||
|
Loading…
Reference in New Issue
Block a user