MySQL BETWEEN & Alias

MySQL CASE

To specify a range of test you can use BETWEEN operator.

Example of BETWEEN:

SELECT * FROM users WHERE age BETWEEN 18 AND 55;

Here below 18 and above 55 aged user will be eliminated.

For your own understand you can give an alias name to a column while getting the data from a table. This is called alias.

SELECT first_name AS `name` FROM users WHERE age BETWEEN 18 AND 55;

Leave a Reply

Your email address will not be published. Required fields are marked *