vue 三元运算符 语法
The BETWEEN Operator is useful because of the SQL Query Optimizer. Although BETWEEN is functionally the same as: x <= element <= y, the SQL Query Optimizer will recognize this command faster, and has optimized code for running it.
由于使用了SQL查询优化器,因此BETWEEN运算符很有用。 尽管BETWEEN在功能上与以下命令相同:x <= element <= y,但是SQL Query Optimizer将更快地识别此命令,并具有用于运行该命令的优化代码。
This operator is used in a WHERE clause or in a GROUP BY HAVING clause.
在WHERE子句或GROUP BY HAVING子句中使用此运算符。
Rows are selected that have a value greater than the minimum value and less than the maximum value.
选择的行的值大于最小值且小于最大值。
It’s important to keep in mind that the values entered in the command are excluded from the result. We get just what is between them.
重要的是要记住,从结果中排除在命令中输入的值。 我们得到他们之间的一切。
Here is the syntax for using the function in a WHERE Clause:
这是在WHERE子句中使用该函数的语法:
select field1, testField
from table1
where testField between min and max
Here is an example using the student table and the WHERE clause:
这是一个使用学生表和WHERE子句的示例:
-- no WHERE clause
select studentID, FullName, studentID
from student;
-- WHERE clause with between
select studentID, FullName, studentID
from student
where studentID between 2 and 7;
Here is an example using the campaign funds table and the having clause. This will return rows where the sum of the donations for a candidate are between $3 Million and $18 Million based on the HAVING clause in the GROUP BY part of the statement. More on aggregation in that guide.
这是使用竞选资金表和having子句的示例。 这将返回行,其中基于该语句的GROUP BY部分中的HAVING子句,候选人的捐款总额在300万美元至1800万美元之间。 该指南中有关聚合的更多信息。
select Candidate, Office_Sought, Election_Year, format(sum(Total_$),2)
from combined_party_data
where Election_Year = 2016
group by Candidate, Office_Sought, Election_Year
having sum(Total_$) between 3000000 and 18000000
order by sum(Total_$) desc;
翻译自: https://www.freecodecamp.org/news/sql-between-operator/
vue 三元运算符 语法