Blog Archives

Select Random Records in MySQL

Selecting random records from a table is helpful when showing items with no preferences or testing different result sets. The following SQL defines a table holding images. Imagine that we wish to pick up 10 random rows from it. In

Tagged with: , , ,
Posted in MySQL, SQL

Generate Serial Number in SQL

The next query generates results as below. Suppose we want to add a column with serial numbers, just as below. In MySQL, this can be done by defining a variable in the query: Reference: MySQL User Defined Variables

Tagged with: , , ,
Posted in SQL