1. 以下是一个表的数据
year month account
1991 | 1 | 1.1 |
1991 | 2 | 1.2 |
1991 | 3 | 1.3 |
1991 | 4 | 1.4 |
1992 | 1 | 2.1 |
1992 | 2 | 2.2 |
请写出sql语句 查询出的表如下
year m1 m2 m3 m4
1991 1.1 1.2 1.3 1.4
1992 2.1 2.2 0 0
答案: 表的名称:yearMonthAccount
1.先插入1992年3,4月份的account 的数据 :insert into yearMonthAccount values (1992,3,0),(1992,4,0);
2 自连接四个表,按照四个表的月份进行筛选,sql语句如下:
select a.year 'YEAR',a.account 'M1',b.account 'M2',c.account 'M3' ,d.account 'M4' from yearMonthAccount a, yearMonthAccount b,yearMonthAccount c , yearMonthAccount d where
a.year=b.year and
b.year=c.year and
c.year=d.year and
a.month=1 and
b.month=2 and
c.month=3 and
d.month=4 结果截图:
2.求以下的表达式,写出你想到的一种或者几种实现方法:1+1+2+3+5+8+13+.............
c# 实现的方法有:
<span style="font-size:18px;"> public int fbo ()
{
int all = 0; //总数
int top=1;//记录上一个数
int next=1;//记录下一个数
for (; ; )
{
if (next == 1)
{
all = top + next; //总数加起来
next = next + top;//下一个数
}
else
{
int head = next; </span><span style="font-size: 18px; font-family: Arial, Helvetica, sans-serif;">// 加之前记录上一个数</span><span style="font-size:18px;">
all = all + next; //相加得总数
next = top + next; //求出一个数;
top = head;
}
}
return all;
}</span>
3.请编程遍历WebFrom页面上所有 TextBox控件并给它赋值为string.empty?
foreach (System.Windows.Forms.Control control in this.Controls) { if (control is System.Windows.Forms.TextBox) { System.Windows.Forms.TextBox tb = (System.Windows.Forms.TextBox)control ; tb.Text = String.Empty ; } }
4.请写出一个算法 产生一个int数组,长度为100,并向其中随机插入1--100,并且不能重复
for int[] getRandom() { int[] intArr=new int[100]; ArrayList myList=new ArrayList(); Random rnd=new Random(); while(myList.Count<100) { int num=rnd.Next(1,101); if(!myList.Contains(num)) myList.Add(num); } for(int i=0;i<100;i++) intArr[i]=(int)my }