Category SQL

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…

SQL Joins

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 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…

SQL IN Operator

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 Wildcards

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…

SQL AVG() Function

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.

SQL SUM() Function

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;