
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How can SELECT, without reference to any table, be used to calculate expression in MySQL?
With the help of following MySQL statement, we can use SELECT to calculate the expression −
SELECT expression;
The above statement is having no reference to any table. Followings are some examples −
mysql> Select 10 DIV 5; +----------+ | 10 DIV 5 | +----------+ | 2 | +----------+ 1 row in set (0.06 sec) mysql> Select 10*5; +------+ | 10*5 | +------+ | 50 | +------+ 1 row in set (0.00 sec) mysql> Set @var1 = 100, @var2 = 200; Query OK, 0 rows affected (0.00 sec) mysql> Select @Var1+@Var2; +-------------+ | @Var1+@Var2 | +-------------+ | 300 | +-------------+ 1 row in set (0.00 sec)
- Related Articles
- How Groups function can be used in MySQL SELECT clause?
- How an enumeration value in MySQL can be used in an expression?
- Can a number be used to name a MySQL table column?
- How to create a temporary MySQL table in a SELECT statement without a separate CREATE TABLE?
- How can we use MySQL SELECT without FROM clause?
- What is the meaning of “SELECT” statement in MySQL and how can it be used?
- Check if table exist without using “select from” in MySQL?
- Can we select second largest record from a table without using LIMIT clause in MySQL?
- How can SciPy be used to calculate the inverse of a matrix in Python?
- How can SciPy be used to calculate the permutations and combination values in Python?
- How can we create MySQL views without any column list?
- Can finally block be used without catch in Java?
- How to implement CANDIDATE key in any MySQL table?
- How MySQL LEFT JOIN can be used to simulate the MySQL MINUS query?
- How can SciPy be used to calculate the determinant value of a matrix in Python?

Advertisements