--定义三个变量(行、列、输出字符串) 通过横竖 九行九列 进行循环输出
DECLARE @a smallint,@b smallint,@str varchar(1000)
set @a=1
WHILE @a<=9
BEGIN
SET @b=1
SET @str=''
WHILE @b<=@a
BEGIN
SELECT @str=@str+convert(varchar(1),@b)+'*'+convert(varchar(1),@a)+'='+convert(char(2),@a*@b)+space(2)
SET @b=@b+1
END
PRINT @str
SET @a=@a+1
END
扩展资料:
T-SQL语句
T-SQL 即 Transact-SQL,是 SQL 在 Microsoft SQL Server 上的增强版,它是用来让应用程序与 SQL Server 沟通的主要语言。T-SQL 提供标准 SQL 的 DDL 和 DML 功能,加上延伸的函数、系统预存程序以及程式设计结构(例如 IF 和 WHILE)让程式设计更有d性。
参考资料来源:百度百科-t-sql
语言种类太多了,所有语言都可以写出乘法表SQL写99乘法表
1:
select r1 || '*' || 1 || '=' || r1 * 1 A,
decode(r2, '', '', r2 || '*' || 2 || '=' || r2 * 2) b,
decode(r3, '', '', r3 || '*' || 3 || '=' || r3 * 3) C,
decode(r4, '', '', r4 || '*' || 4 || '=' || r4 * 4) D,
decode(r5, '', '', r5 || '*' || 5 || '=' || r5 * 5) E,
decode(r6, '', '', r6 || '*' || 6 || '=' || r6 * 6) F,
decode(r7, '', '', r7 || '*' || 7 || '=' || r7 * 7) G,
decode(r8, '', '', r8 || '*' || 8 || '=' || r8 * 8) H,
decode(r9, '', '', r9 || '*' || 9 || '=' || r9 * 9) I
from (select level r1,
lag(level+1, 1) over(order by level) r2,
lag(level+2, 2) over(order by level) r3,
lag(level+3, 3) over(order by level) r4,
lag(level+4, 4) over(order by level) r5,
lag(level+5, 5) over(order by level) r6,
lag(level+6, 6) over(order by level) r7,
lag(level+7, 7) over(order by level) r8,
lag(level+8, 8) over(order by level) r9
from dual
connect by level <10)
2:
select rn, ltrim(max(sys_connect_by_path(product, ',')), ',') product
from
(
select rn, product, min(product) over(partition by rn) product_min
,(row_number() over(order by rn, product)) + (dense_rank() over(order by rn)) numId
from
(
select b.rn, a.rn || '*' || b.rn || '=' || a.rn * b.rn product
from (select rownum rn from all_objects where rownum <= 9) a,
(select rownum rn from all_objects where rownum <= 9) b
where a.rn <= b.rn
order by b.rn, product
)
)
start with product = product_min
connect by numId - 1 = prior numId
group by rn
九九乘法表:<%
dim i,j
for i=1 to 9
for j=1 to 9
if j<=i then
response.write(j)
response.write("*")
response.write(i)
response.write("=")
response.write(i*j)&" "
else
end if
next
response.write("<br>")
next
%>
数据库中添加\删除\更新记录的语句,网上很多,自己搜搜吧
http://www.xker.com/page/e2008/0715/54621.html
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)