标签:
一、不定项选择题
1、B
2、AD
3、CD
4、A
5、ACD
6、BD
7、C
8、BCD
9、C
10、AB 主键不一定能提高查找的速度
二、填空题
1、奇,偶
2、ls -l,ps -aux
3、
4、BABBAB
5、数据定义,数据操作,数据控制
三、数据库
1、
create table S(
Sno int primary key auto_increment,
Sname varchar(20)
);
insert into S(sname) values(‘he‘);
insert into S(sname) values(‘wang‘);
create table C(
Cno int primary key auto_increment,
Cname varchar(20),
Ccredit int
);
insert into C(cname,Ccredit) values(‘JAVA‘,3);
insert into C(cname,Ccredit) values(‘C‘,2);
Drop table if exists SC;
create table SC(
id int primary key auto_increment,
Sno int,
Cno int,
Grade int
);
insert into SC(Sno,cno,Grade) values(1,1,100);
insert into SC(Sno,cno,Grade) values(1,2,90);
insert into SC(Sno,cno,Grade) values(2,1,80);
insert into SC(Sno,cno,Grade) values(2,2,70);
insert into SC(Sno,cno,Grade,Teacher) values(3,1,80,‘zhang‘);
insert into SC(Sno,cno,Grade,Teacher) values(3,2,70,‘zhang‘);
1)select distinct Sname From S,SC,C where S.sno = SC.sno and c.Cno = SC.cno and
Cname=‘JAVA‘ order by Sname desc;
2)select S.Sno,Sum(Ccredit) From S,SC,C where S.sno = SC.sno and c.Cno = SC.cno
and Grade>60 group by Sno having sum(Ccredit)>80;
3)ALTER table SC ADD Teacher varchar(20) not null;
4)CREATE VIEW SCSum(sno,Ccredit) as Select S.Sno,Sum(Ccredit) From S,SC,C
where S.sno = SC.sno and c.Cno = SC.cno group by Sno;
5)delete from SC where sno not in(select distinct S.Sno from S);
四、程序设计题
package hengsheng; public class Exe1 { public static void main(String[] args) { for(int i=123;i<330;i++){ int a = i*2; int b = i*3; if(isok(i,a,b)){ System.out.println(i+","+a+","+b); } } } /** * 判断三个整数中是否有重复的字符 * @return false:有;true:否 */ private static boolean isok(int i,int a,int b) { int[] s = new int[9]; s[0] = i%10; s[1] = i%100/10; s[2] = i/100; s[3] = a%10; s[4] = a%100/10; s[5] = a/100; s[6] = b%10; s[7] = b%100/10; s[8] = b/100; //判断s中是否有相同的数字 for(int j=0;j<s.length;j++){ for(int k=j;k<s.length;k++){ if(j != k && s[j] == s[k]) return false; } } return true; } }
标签:
原文地址:http://www.cnblogs.com/hzhtracy/p/4761094.html