Dividend is the numeric expression to divide. Dividend must be any expression of integer data type in sql server.
除数是用来除除除数的数值表达式。除了在 sql 服务器中,除数必须是整数数据类型的表达式。
SELECT 15 % 2
Output
1
红利 = 15
除数 = 2
假设你想要询问
仅查询 STATION 中具有偶数 ID 号的 CITY 名称列表。
Schema structure for STATION:
ID Number
CITY varchar
STATE varchar
select CITY from STATION as st where st.id % 2 = 0
Will fetch the even set of records
In order to fetch the odd records with Id as odd number.
select CITY from STATION as st where st.id % 2 <> 0