Home >Database >Mysql Tutorial >How can we use MySQL SELECT without FROM clause?

How can we use MySQL SELECT without FROM clause?

王林
王林forward
2023-09-10 09:37:021118browse

我们如何使用没有 FROM 子句的 MySQL SELECT?

#The FROM clause after the SELECT shows a reference to the table. But if there is no reference to any table, then we can use SELECT without FROM clause. In other words, we can say that SELECT can be used to retrieve rows calculated without referencing any table. Consider the following statement -

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)

The above is the detailed content of How can we use MySQL SELECT without FROM clause?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete