"Author's Homepage": Shibie Sanshi wyx
"Author's Profile": CSDN top100, Alibaba Cloud blog expert, Huawei cloud expert, high-quality creator in the field of network security
"Column Introduction": This article has been entered in the column "MySQL Database Quick Start"
if function
1. Function
"Judging" whether the condition is true, execute one statement when it is true, and execute another statement when it is not true.
2. Grammar
if(condition,T,F)
parameter
- condition : The condition that needs to be judged, which can be a data or a statement.
- T : The statement to execute when the condition is true.
- F : Statement to execute when the condition is not met.
3. Use
Judging whether the condition (2>1) is established, if so, output 1, if not, output 2: