从MySQL表中选择1是什么意思?
任何表名中的语句“选择1”表示仅返回1。例如,如果任何表有4条记录,则它将四次返回1。
让我们来看一个例子。首先,我们将使用CREATE命令创建一个表。
mysql> create table StudentTable -> ( -> id int, -> name varchar(100) -> );
插入记录
mysql> insert into StudentTable values(1,'John'),(2,'Carol'),(3,'Smith'),(4,'Bob'); Records: 4 Duplicates: 0 Warnings: 0
显示所有记录。
mysql> select *from StudentTable;
这是输出。
+------+-------+ | id | name | +------+-------+ | 1 | John | | 2 | Carol | | 3 | Smith | | 4 | Bob | +------+-------+ 4 rows in set (0.00 sec)
以下是实现“选择1”的查询。
mysql> select 1 from StudentTable;
这是输出。
+---+ | 1 | +---+ | 1 | | 1 | | 1 | | 1 | +---+ 4 rows in set (0.00 sec)
上面对于4条记录返回1次四次,如果我们有5条记录,则上述查询将返回1次五次。
Note: It returns 1 N times, if the table has N records.
热门推荐
1 狗狗下楼训练
3 狗狗训练头盔
6 狗狗训练机构
7 训练狗狗步骤
9 狗狗能训练
10 狗狗基本动作训练方法
11 怎么训练狗狗叼饭盆
12 狗狗一岁了还能训练吗
13 训练狗狗的
14 宁波狗狗训练
15 训练狗狗拉屎
16 教狗狗训练
17 狗狗要怎么训练上厕所
18 狗狗靠的训练