SQL INNER JOIN
INNER JOIN The INNER JOIN keyword selects records that have matching values in both tables. Let’s look at a selection of the Products table: ProductID ProductName CategoryID Price 1 Chais 1 18 2 Chang 1 19 3 Aniseed Syrup 2…
INNER JOIN The INNER JOIN keyword selects records that have matching values in both tables. Let’s look at a selection of the Products table: ProductID ProductName CategoryID Price 1 Chais 1 18 2 Chang 1 19 3 Aniseed Syrup 2…
SQL JOIN A JOIN clause is used to combine rows from two or more tables, based on a related column between them. Let’s look at a selection from the “Orders” table: OrderID CustomerID OrderDate 10308 2 1996-09-18 10309 37 1996-09-19…
SQL Aliases SQL aliases are used to give a table, or a column in a table, a temporary name. Aliases are often used to make column names more readable. An alias only exists for the duration of that query. An…
The SQL BETWEEN Operator The BETWEEN operator selects values within a given range. The values can be numbers, text, or dates. The BETWEEN operator is inclusive: begin and end values are included. Example Selects all products with a price between…
The SQL IN Operator The IN operator allows you to specify multiple values in a WHERE clause. The IN operator is a shorthand for multiple OR conditions. Example Return all customers from ‘Germany’, ‘France’, or ‘UK’ SELECT * FROM Customers…
SQL Wildcard Characters A wildcard character is used to substitute one or more characters in a string. Wildcard characters are used with the LIKE operator. The LIKE operator is used in a WHERE clause to search for a specified pattern…
The SQL LIKE Operator The LIKE operator is used in a WHERE clause to search for a specified pattern in a column. There are two wildcards often used in conjunction with the LIKE operator: The percent sign % represents zero,…
The SQL AVG() Function The AVG() function returns the average value of a numeric column. Example Find the average price of all products: SELECT AVG(Price) FROM Products; Note: NULL values are ignored.
The SQL SUM() Function The SUM() function returns the total sum of a numeric column. Example Return the sum of all Quantity fields in the OrderDetails table: SELECT SUM(Quantity) FROM OrderDetails;