编写一个程序根据年龄判断一个人是不是儿童(设一个人的年龄少于10岁为儿童)
declare @age int
set @age=1
if @age<10
print '儿童'
else
print '不是儿童'
请问可以自己输入age吗?
我不知道SQL 语句编程有键盘输入的吗(比如C语言中的scanf)
没有。
的确是没有键盘输入的
写存储过程 把age当个参数传布就行了
create proc s
@age int
as
if @age<10
print '儿童'
else
print '不是儿童'
exec s '9'
没有..
靠, 把sql当编程语言了。
sql= structure query language
可以使用存储过程呀
如下:
SQL code:
create proc prcIsChild
@age int
as
begin
if @age<10
print '儿童'
else
print '不是儿童'
end
引用 可以使用存储过程呀 如下: SQL code create proc prcIsChild @age int as begin if @age<10 print '儿童' else print '不是儿童' end那如果写存储过程要求输入参数把学生从xs,kc和xk表中查询出这些学生学号姓名,以及所选的课程名和成绩
这样写对吗?
create proc test_proc2
as
select xs.xh,xsxm,kcm,cj from xs,kc,xk
exec test_proc2 ' ',' ',' ',' ' --‘ ’里面是写具体的参数,我没写
相关问答:
type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jas ......
我一个项目,有个插入操作,具体是这样的: 我有进货信息表。在出货时选择相应的进货信息,输入数量,选择部门后,点保存按钮,由于网络延时,点一下没有反映,于是用户就又点一下,导致一次插入了两条记录: 例:
......
tab1 字段:billdate,goodsid,incount,inmoney,outcount,outmoney,endprice,endcount,endamt tab2 字段:goodsid,goodskind(商品类型) tab3 字段:goodskind(商品类型),kindname 结果: 得到商品类型在一段时间 ......
select o_customer,o_price from orders having o_price >=avg(o_price) select o_customer,o_price from orders where o_price >=(select avg(o_price) from orders) 我感觉没有区别啊,怎么在mysql会有 ......
A表 有两个字段 id 唯一数字域 InfoTxt text 类型 我现在要把 id 不是14 的所有 InfoTxt字段 文本后面 都加上 'aaa' 按下面执行下来 只有表最后一行加上了 'aaa' ......