展开全部
(二) java 部分
c)class Test01 {
private final static String[] monji = { "零", "一", "二", "三", "四", "五", "六", "七",
"八", "九", "十" };
public static void main(String args[]) {
printZH(new Date());
}
private static String getFormatted(String param) {
String result = "";
for (int i = 0; i < param.length(); i++) {
result += monji[Integer.parseInt(param.substring(i, i + 1))];
}
return result;
}
public static void printZH(Date date) {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
String dateStr = df.format(date);
String clips[] = dateStr.split("-");
String formatted = "";
String year = clips[0];
String month = clips[1];
String day = clips[2];
formatted += getFormatted(year) + "年";
if (month.compareTo("9") > 0) {
formatted += monji[10]
+ (getFormatted(month.substring(1)).equals(monji[0]) ? ""
: getFormatted(month.substring(1)));
} else {
formatted += getFormatted(month).substring(1);
}
formatted += "月";
if (day.compareTo("9") > 0) {
formatted += getFormatted(day.substring(0, 1))
+ monji[10]
+ (getFormatted(day.substring(1)).equals(monji[0]) ? ""
: getFormatted(day.substring(1)));
} else {
formatted += getFormatted(day).substring(1);
}
formatted += "日";
System.out.println(formatted);
}
}
d)-- 输出的结果 ----
""
"|"
"a"
"b"
"|"
"c"
e) class Test02 {
public static void print(String str){
int length = str.length();
for(int i=length; i>0 ;i--){
for(int j = 0; j < length - i + 1;j++){
System.out.println(str.substring(j, j+i));
}
}
}
public static void main(String args[]) {
print("1234");
}
}
(四)SQL
a)
1)oracle: select * from tbl_tra where to_char(transaction_date, 'yyyy-MM-dd') = '2009-11-17';
或者select * from tbl_tra where trunc(transaction_date, 'yyyy-MM-dd') = '2009-11-17';
SQL server: select * from tbl_tra where cast(transaction_date, 112) = '20091117';
2)where gift='210' 这种更快,因为oracle中number类型占用0~22个字节,属于变长数据类型,需要oracle根据
一定算法采用尽可能少的存储空间表示,而char的比较不需要计算存储空间和存储.
b)
select distinct name from t_demo t1
where not exists (select 1 from t_demo t2 where t2.fenshu <=80 and t2.name = t1.name and t2.kecheng = t2.kecheng );
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询