SQLʱ¼äÀàÐÍÄ£ºý²éѯ
Êý¾Ý¿âÀàÐÍΪDateTimeÀàÐÍ£¬½«Æä×öÄ£ºý²éѯʱ£¬ÔÚHibernateÖУ¬¿ÉÒÔÓÃÆ´SQLµÄÎÊÌ⽫Æä½â¾ö£¬¼´ÔÚSQL²éѯ·ÖÎöÆ÷дSQLÒ»Ñù£¬µ«ÊÇÀûÓòÎÊýÅäÖã¬Ôò·½·¨ÈçÏ£º
1¡¢Æ´ÉÏSQL,È磺
String beginPara= " and b.date>= :begin";
String endPara= " and b.date<= :end";
2¡¢hqlÓï¾ä½øÐвÎÊýÅäÖá£È磺
queryString.append(beginPara);
queryString.append(endPara);
3¡¢½øÐвÎÊýÉèÖã¬Èç
q.setString("begin", date+" 00:00:00");
q.setString("end", date+" 23:59:59");
ÒÔÉÏÔòÊDzéÒ»ÌìµÄʱ¼äÀàÐÍÊý¾Ý
Ïà¹ØÎĵµ£º
Ò».Êý¾Ý¿ØÖÆÓï¾ä (DML) ²¿·Ö
1.Insert (ÍùÊý¾Ý±íÀï²åÈë¼Ç¼µÄÓï¾ä)
Insert INTO ±íÃû(×Ö¶ÎÃû1, ×Ö¶ÎÃû2, ……) VALUES ( Öµ1, Öµ2, ……);
&nb ......
Ò».MYSQLµÄÃüÁîÐÐģʽµÄÉèÖãº
×ÀÃæ->ÎҵĵçÄÔ->ÊôÐÔ->»·¾³±äÁ¿->н¨->
PATH=“£»path\mysql\bin;”ÆäÖÐpathΪMYSQLµÄ°²×°Â·¾¶¡£
¶þ.¼òµ¥µÄ½éÉÜÒ»ÏÂÃüÁîÐнøÈëMYSQLµÄ·½·¨£º
1.C:\>mysql -h hostname -u username -p
°´ENTER¼ü£¬µÈ´ýÈ»ºóÊäÈëÃÜÂë¡£ÕâÀïhostnameΪ·þÎñÆ÷µÄÃû³Æ£¬Èçlocalh ......
ÒªÔÚSQL ServerÊý¾Ý¿âÖд洢m³²¢´òÓ¡³öÀ´, ·½·¨ÈçÏ£º
1£©½«Êý¾Ý¿âÖÐÏàÓ¦×ֶεÄÊý¾ÝÀàÐÍÉèΪnchar»ònvarcharÀàÐÍ¡£
2£©´ÓExcelÖеõ½m³£¬¸´ÖÆÕ³Ìùµ½½ÓÊÕÊý¾ÝµÄ¿Ø¼þÖУ¨TextBox¡¢DataGridViewµÈ£©¡£±£´æ¼´¿É¡£
×¢£º1£©nchar,nvarcharÓëchar,varcharµ ......
http://xujunprogrammer.blog.hexun.com/8376520_d.html
SQL ServerÖÐÎÄ°æµÄĬÈϵÄÈÕÆÚ×Ö¶Îdatetime¸ñʽÊÇyyyy-mm-dd Thh:mm:ss.mmm
ÀýÈç:
select getdate()
2004-09-12 11:06:08.177
Õâ¶ÔÓÚÔÚÒª²»Í¬Êý¾Ý¿â¼äתÒÆÊý¾Ý»òÕßÏ°¹ßoracleÈÕÆÚ¸ñʽYYYY-MM-DD HH24:MI:SSµÄÈ˶àÉÙÓÐЩ²»·½±ã.
ÎÒÕûÀíÁËÒ»ÏÂSQL ServerÀïÃæ¿ÉÄ ......