MySQL BETWEEN Operator

The MySQL 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. BETWEEN Syntax Demo Database Below is a selection from the “Products” table in the Northwind sample database: ProductID ProductName SupplierID CategoryID Unit Price […]

MySQL IN Operator

The MySQL 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. IN Syntax or: Demo Database The table below shows the complete “Customers” table from the Northwind sample database: CustomerID CustomerName ContactName Address City PostalCode Country 1 Alfreds Futterkiste […]

MySQL Wildcards

MySQL 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 in a column. Wildcard Characters in MySQL Symbol Description Example % Represents zero or more […]

MySQL LIKE Operator

The MySQL 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, one, or multiple characters The underscore sign (_) represents one, single character The percent sign […]

MySQL COUNT(), AVG() and SUM() Functions

MySQL COUNT(), AVG() and SUM() Functions The COUNT() function returns the number of rows that matches a specified criterion. COUNT() Syntax The AVG() function returns the average value of a numeric column.  AVG() Syntax The SUM() function returns the total sum of a numeric column.  SUM() Syntax Demo Database Below is a selection from the […]

MySQL MIN() and MAX() Functions

MySQL MIN() and MAX() Functions The MIN() function returns the smallest value of the selected column. The MAX() function returns the largest value of the selected column. MIN() Syntax MAX() Syntax Demo Database Below is a selection from the “Products” table in the Northwind sample database: ProductID ProductName SupplierID CategoryID Unit Price 1 Chais 1 […]

MySQL LIMIT Clause

The MySQL LIMIT Clause The LIMIT clause is used to specify the number of records to return. The LIMIT clause is useful on large tables with thousands of records. Returning a large number of records can impact performance. LIMIT Syntax Demo Database Below is a selection from the “Customers” table in the Northwind sample database: […]

MySQL DELETE Statement

The MySQL DELETE Statement The DELETE statement is used to delete existing records in a table. DELETE Syntax Note: Be careful when deleting records in a table! Notice the WHERE clause in the DELETE statement. The WHERE clause specifies which record(s) should be deleted. If you omit the WHERE clause, all records in the table […]