´«ÖDz¥¿Íjavaѧϰ sql³£Óú¯Êý
ÎÒ½ñÌìѧϰÁËsqlÓï¾äµÄ³£Óú¯Êý£¬ÊÇ·ëÍþÀÏʦ½²µÄ£¬ÎÒ×öÁ˼òµ¥µÄ±Ê¼Ç£º
Ò»£¬SQLº¯Êý£º
1. ´óСдת»»º¯Êý
lower ת³ÉСд
upper ´óд
initcap ½«×Ö·û´®µÄ(ÿ¸öµ¥´ÊµÄ)µÚÒ»¸ö×Öĸ±äΪ´óд,ºóÃæµÄСд
select initcap('huangHY') from dual
½«Ê××Öĸ±ä³É´óд£¬ÆäÓàµÄ±ä³ÉСд
2. ×Ö·û´¦Àíº¯Êý
concat Á¬½ÓÁ½¸ö×Ö·û´®
select concat(first_name,last_name) from employees
substr ·µ»Ø×Ó×Ö·û´®
select substr('huangu',2,3) from dual
length ·µ»Ø×Ö·û´®³¤¶È
select length('huangyu') from dual
instr(c1,c2,i,j) ×Ó´®µÄλÖÃ
select instr('huangyu','yu',2,3) from dual
lpad ²¹³ä
lpad('husangyu',10,'*') from dual
rpad
trim ,½ØÈ¡Á½¶ËµÄ¿Õ¸ñ
select trim('huangyu') from dual
replace('wewwew','e','huangyu') Ìæ»»º¯Êý
3.Êýѧº¯Êý
round(num1,2) °´Ö¸¶¨µÄСÊýλÊý½øÐÐËÄÉáÎåÈë,δָ¶¨ÔòĬÈÏΪ0
select round(333.353,2) 333.35
mod(num1,num2) Á½ÊýÏë³ý
4.ÈÕÆÚº¯Êý
months_between() ¼ÆËãÁ½¸öÈÕÆÚÏà²î¶àÉÙÔ£¿
add_months(sysdate,10)¼ÓÊ®¸öÔÂ
next_day(date,'ÐÇÆÚÎå')
last_day(syadete) ,¼ÆËãÖ¸¶¨ÈÕÆÚµÄ×îºóÒ»Ìì
trunc(date)
round(date,'YY') ±¾ÄêµÄµÚÒ»Ìì
round(date,'DD')µ±Ç°ÈÕÆÚ
round(date,'mm') ±¾ÔµÚÒ»Ìì
round(date,'dy') ±¾ÖܵÚÒ»Ìì(ÐÇÆÚËĽøλ)
5.ת»»º¯Êý
ÏÔʾµÄÊý¾ÝÀàÐÍת»»£º
to_char(date,'fmt')
to_char(sysdate,'yy-mm-dd')
Êä³öÈÕÆÚµÄ×Ö·û´®±íʾ¸ñʽ£»
6.ÐÞ¸ÄΪÖÐÎÄÓïÑÔ»·¾³
alter session set nls_language='SIMPLIFIED CHINESE'
7£¬ ÈÕÆÚµÄÓ
Ïà¹ØÎĵµ£º
ÓÐʱºòÎÒÃÅÐèÒª°ÑEXCEL±í¸ñÖеÄÊý¾Ýת»»³ÉXML¸ñʽ ÕâÐèÒªÓõ½JXL(·ÖÎöEXCEL)°üºÍJDOM°ü(¹¹³ÉXML)
import java.io.*;
import jxl.*;
import org.jdom.Element;
import org.jdom.Document;
import org.jdom.output.XMLOutputter;
/**
*
* @author guo
*/
public class EtoX {
  ......
public class select {
public List XiuGai_select(String keyword){
List list=new ArrayList();
Connection conn = null;
Statement stmt = null;
String sql=null;
ResultSet res = null;
get ......
SQL ServerÊý¾ÝÀàÐÍ2009Äê02ÔÂ02ÈÕ ÐÇÆÚÒ» 11:20Êý¾ÝÀàÐÍÊÇÊý¾ÝµÄÒ»ÖÖÊôÐÔ£¬ÊÇÊý¾ÝËù±íʾÐÅÏ¢µÄÀàÐÍ¡£ÈκÎÒ»ÖÖÓïÑÔ¶¼ÓÐËü×Ô¼ºËù¹ÌÓеÄÊý¾ÝÀàÐÍ£¬SQL ServerÌṩһÏÂ25ÖÖ¹ÌÓеÄÊý¾ÝÀàÐÍ¡£ SQL ServerÊý¾ÝÀàÐÍÒ»ÀÀ±í
¡¡¡¡·Binary [(n)]
·Varbinary [(n)]
·Char [(n)]
·Varchar[(n)]
· ......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
//sqlserverÉí·ÝÑéÖ¤
//string sqlconn = "ser ......
×òÌìŪÁËÒ»¸ö±È½Ï¼¬ÊÖµÄÎÊÌâ¡£´ÓÍøÉÏÏÂÔØÁËÒ»¸öÈí¼þ£¬ËûµÄÊý¾Ý¿âÊÇaccessµÄ£¬´ò¿ª¿´ÁËһϣ¬¸Ð¾õ²»´í£¬ÊʺÏÎÒÏÖÔÚÏîÄ¿µÄÐèÇ󣬴󲿷ÖÄܹ»Âú×ãÎÒµÄÏîÄ¿ÐèÒª£¬¾ÍÏëÄÃÀ´Ö÷Òå¡£¿ÉÊÇÎÒÃÇÏîÄ¿µÄÊý¾Ý¿âÒ»Ö±¶¼ÊÇÓõÄsqlserver£¬ÓÚÊÇ£¬¾ÍÔÚÍøÉÏ·è¿ñµÄ£¬ÕÒ¹ØÓÚaccessת»»ÎªsqlserverµÄ×ÊÁÏÔÚÕâÀïÎÒÏë˵һÏÂÓйصÄ×¢ÒâÊÂÏ
Êý¾Ý¿âÉý ......