谁给写一句sql语句。实现加减乘除的。

2025-02-25 15:40:05
推荐回答(5个)
回答1:

select Pr ,Ph,(convert(int,Pr)/convert(int,Ph)) as 'Pr/Ph' from basic

你好对于你的要求 以上的语句就足以了 加减乘除,需要改动符号就行了 希望对你有所帮助

回答2:

declare @tab table
(
Pr int,
Ph int,
[Pr/Ph] int
)
insert into @tab values(4,2,0)
select Pr,Ph,(Pr/Ph) as [Pr/Ph] from @tab

或者表@tab 不用[Pr/Ph]这个列 因为这列是通过计算得来的。

declare @tab table
(
Pr int,
Ph int
)
insert into @tab values(4,2)
select Pr,Ph,(Pr/Ph) as [Pr/Ph] from @tab

回答3:

select 4 pr,2 ph,4/2 pr除ph from dual

回答4:

select convert(int,pr)/convert(int,ph) from 表

回答5:

select Pr,Ph ,Pr/Ph from 表 where Pr=2*Ph and ph<>0