从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 带狗狗训练
4 听力训练狗狗
6 怎训练狗狗
7 腹肌训练狗狗
8 网球训练狗狗
9 记叙文训练狗狗
10 狗狗太凶怎么训练
11 核心力量训练狗狗
12 狗狗乱叫怎么训练
13 发音训练狗狗
14 怎么训练狗狗叼东西给主人
15 荆州训练狗狗
16 篮球训练狗狗
17 做训练狗狗
18 训练狗狗坐姿