How can we use MySQL SELECT without FROM clause?

MySQLMySQLi Database

FROM clause after SELECT shows the references to a table. But if there is no reference to any table then we can use SELECT without the FROM clause. In other words, we can say that SELECT can be used to retrieve rows computed without reference to any table. Consider the following statements −

mysql> Select concat_ws(" ","Hello", "World");
+---------------------------------+
| concat_ws(" ","Hello", "World") |
+---------------------------------+
| Hello World                     |
+---------------------------------+
1 row in set (0.00 sec)

mysql> Set @var1=100;
Query OK, 0 rows affected (0.00 sec)

mysql> Select @var1;
+-------+
| @var1 |
+-------+
|   100 |
+-------+
1 row in set (0.00 sec)
raja
Published on 22-Feb-2018 06:44:14
Advertisements