SQL语句打印四个方向的9 9 乘法表
declare @i int ,@j int ,@s nvarchar(max)
set @i = 1
while @i <=9
begin
set @s = ' '
set @j = 1
while @j <=@i
begin
set @s += cast(@j as char(1)) + '*' + cast(@i as char(1))
set @s += ' '
set @j +=1
end
print @s
set @i += 1
end
declare @i int ,@j int ,@s nvarchar(max)
set @i = 1
while @i <=9
begin
set @s = ''
set @j = 1
while @j <=9
begin
if @j >= @i
begin
set @s += cast(@i as char(1)) + '*' + cast(@j as char(1))
set @s += ' '
end
else
begin
set @s += ' '
end
set @j +=1
end
print @s
set @i += 1
end
declare @i int ,@j int ,@s nvarchar(max)
set @i = 1
while @i <=9
begin
set @s = ''
set @j = 1
while @j <=@i
begin
if @j >= @i
begin
set @s += cast(@i as char(1)) + '*' + cast(@j as char(1))
set @s += ' '
end set @j +=1
end
print @s
set @i += 1
end
declare @i int ,@j int ,@s nvarchar(max)
set @i = 1
while @i <=9
begin
set @s = ''
set @j = 1
while @j <=9
begin
if @j > 9 -@i
begin
set @s += cast(@i as char(1)) + '*' + cast((10 -@j) as char(1))
set @s += ' '
end
else
begin
set @s += ' '
end
set @j +=1
end
print @s
set @i += 1
end
SQL语句打印四个方向的9 9 乘法表的更多相关文章
- mybatis的Sql语句打印
我们在使用mybatis的时候,有时候,希望可以在eclipse的控制台下打印出来sql语句,但是有时候却不希望相关的语句打印.这个时候,需要我们进行一些配置. 在mybatis中,他通过调用一些接 ...
- mysql基础复习(SQL语句的四个分类),
( ...
- 抓取锁的sql语句-第四次修改
--完成情况 变量V_BLOCKING_SID 用来动态抓取 产生锁的会话id,输出参数没有任何问题,但是执行报错 标识符无效! CREATE OR REPLACE PROCEDURE SOLV ...
- Spring+MyBatis框架中sql语句的书写,数据集的传递以及多表关联查询
在很多Java EE项目中,Spring+MyBatis框架经常被用到,项目搭建在这里不再赘述,现在要将的是如何在项目中书写,增删改查的语句,如何操作数据库,以及后台如何获取数据,如何进行关联查询,以 ...
- 如何优化用SQL语句INSERT INTO … SELECT插入数据时锁全表的问题
1.binlog format 启用Row Based Replication(行复制)模式: SET GLOBAL binlog_format = 'ROW'; 如果你想永久的启用这个模式,请修改m ...
- 数据库常用SQL语句(一):常用的数据库、表操作及单表查询语句
以MySql数据库为例进行说明 1.数据库操作语句 2.表的操作语句 3.表中的字段操作语句 4.MYSQL支持的完整性约束 数据库管理系统提供了一致机制来检查数据库表中的数据是否满足规定的条件,以保 ...
- SQL语句 打印等腰三角形,菱形
) BEGIN 5 SET @S='' 8 BEGIN -@I) 10 BEGIN SET @S=@S+' ' END ELSE 14 BEGIN SET @S=@S+'**' 16 END END ...
- SQL语句的四种连接
SQL的四种连接查询 内连接 inner join 或者 join 外连接 左连接 left join 或者 left outer join 右连接 right join 或者 right ou ...
- SQL语句(四)联表查询
目录 一.关联查询的分类 按年代分 按功能分 二.sql92语法的连接 语法 1. 简单应用 2. 为表起别名 3. 加入筛选 4. 加入分组 5. 三表连接 6. 非等值连接 7. 自连接 三.sq ...
随机推荐
- usb 驱动
usb 驱动学习总结: usb 采用分层的拓扑结构,金字塔型,最多是7层.usb 是主从结构,主和主或者从和从之间不能交换数据.理论上一个usb主控制器最多可接127个设备,协议规定每个usb设备具有 ...
- connect to a specific wifi network in Android programmatically
http://stackoverflow.com/questions/8818290/how-to-connect-to-a-specific-wifi-network-in-android-prog ...
- android-serialport-api and libusb for android
libusb for android: Even if you get it compiled, Android is probably not going to let you access the ...
- android界面优化笔记(TODO)
1.避免使用线性布局的层层嵌套,要使用相对而已.使用线性布局越多,嵌套越多 官方文档: Optimizing Your UI
- Java之字节输入流和输出流
package IODemo; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOEx ...
- 转载c#泛型 类型参数的约束(c#编程指南)
在定义泛型类时,可以对客户端代码能够在实例化类时用于类型参数的类型种类施加限制.如果客户端代码尝试使用某个约束所不允许的类型来实例化类,则会产生编译时错误.这些限制称为约束.约束是使用 where 上 ...
- prestashop二次开发 笔记(支付插件)
//主函数 public function __construct() { $this->name = 'CilPay'; //模块名称 $this->display ...
- Java WeakReference的理解与使用
转载:http://itindex.net/detail/47754-%E9%9D%A2%E8%AF%95-java-weakreference?utm_source=tuicool&utm_ ...
- redis优化优秀文选
Redis是一个单线程的内存数据库.下载地址如下:http://download.redis.io/releases/redis-2.8.11.tar.gz在Redis的src目录运行make命令,然 ...
- zabbix邮件报警脚本(Python)
#!/usr/bin/python #coding:utf-8 import smtplib from email.mime.text import MIMEText import sys mail_ ...