Latest Tutorials

PRIMARY key in MySQL

The PRIMARY KEY constraint uniquely identifies each record in a database table. Following rules and suggestions are applied to the PRIMARY key:

FOREIGN keys in MySQL:

A FOREIGN KEY in one table points to a PRIMARY KEY in another table. Let say we have two tables here, Emp & Dept. Note that DeptNo column in Dept table points to colum...

What is CHECK constraint in MySQL?

The CHECK constraint specifies a condition that must be true when manipulating the database table. Following example shows how a CHECK constraint may be implemented:

The DEFAULT constraint in MySQL

The DEFAULT constraint is used to insert a default value into a column. The default value will be added to all new records, if no other value is specified. CREATE TAB...

How to retrieve data using SELECT statement?

The only way to retrieve data from a MySQL column is to use the SELECT statement. This is also one of the most often used statements in MySQL. In broader terms, the SELECT...

SELECT Statement with WHERE Clause

The most frequent and simple data querying in MySQL is a combination of SELECT statement and WHERE clause, where the clause directly tells the MySQL how to reference wante...

Order retrieved data with ORDER BY clause

The ORDER BY clause can be used to sort the result with the respect to some column or in ascending or descending order. Following example shows a...

Grouping data in MySQL by using the GROUP BY clause

Grouping retrieved data with the GROUP BY clause, in combination with the

How to constrain (LIMIT) the number of rows in a result set?

The LIMIT clause limits the result of a query in the defined range. The range is defined by using one or two arguments, which both must be zero or a positive integer. The following...

Using HAVING clause to filter group of rows or aggregates

The HAVING clause is used to specify filtering condition for group of rows (or aggregates). It often comes with the