SQL 2008 Çå³ýÈÕÖ¾Îļþ
ÓÒ»÷ÒªÇå³ýÈÕÖ¾µÄÊý¾Ý¿â Ñ¡ÔñÊôÐÔ
ÔÚÊý¾Ý¿âÊôÐÔÖÐ Ñ¡ÔñÑ¡Ïî ÔÚÓұ߻ָ´Ä£Ê½ÏÂÀÁбí¿òÖÐ Ñ¡Ôñ¼òµ¥ µ¥»÷È·¶¨ ·µ»Ø
ÓÒ»÷ÒªÇå³ýÈÕÖ¾µÄÊý¾Ý¿â Ñ¡ÔñÈÎÎñ-ÊÕËõ-Êý¾Ý¿â µ¥»÷È·¶¨
Íê³ÉÊÕËõ ÈÕÖ¾Îļþ´óС±äΪ0
Ïà¹ØÎĵµ£º
·ÅÔÚÕâÀﱸÍü,ÀÏÊÇÍü¼ÇÔõôд¡£
mysql> create database book;
mysql> use book;
Database changed
mysql> create table email_message(key_mail_messages INTEGER,
-> date_created VARCHAR(19),
-> date_updated varchar(19),
-> date_email varchar(19),
-> addr_from va ......
±¾ÎÄתÔØ: http://hi.baidu.com/%D2%BB%C6%F0%C8%A5%CC%DF%C7%F2/blog/item/802027355899fe83a61e12ee.html
ʹÓÃSQLQuery
¶ÔÔÉúSQL²éѯִÐеĿØÖÆÊÇͨ¹ýSQLQuery½Ó¿Ú½øÐеģ¬Í¨¹ýÖ´ÐÐSession.createSQLQuery
()
»ñÈ¡Õâ¸ö½Ó¿Ú¡£×î¼òµ¥µÄÇé¿öÏ£¬ÎÒÃÇ¿ÉÒÔ²ÉÓÃÒÔÏÂÐÎʽ£º
List
cats
=
sess.createSQLQuery
(
......
ʹÓÃSQLÓï¾ä´´½¨Êý¾Ý¿â
±¾ÎÄת×Ô£ºhttp://www.cppblog.com/twzheng/archive/2008/07/07/55508.html
ÓÃCREATE DATABASE´´½¨Êý¾Ý¿âµÄÓï·¨¸ñʽ£º
CREATE DATABASE database_name /*Ö¸¶¨Êý¾Ý¿âÃû*/
[ON× ......
1 ---ÉϸöÔÂÔ³õµÚÒ»Ìì
2 select CONVERT(varchar(12) , DATEADD(mm,DATEDIFF(mm,0,dateadd(mm,-1,getdate())),0), 112 )
3
4 ---ÉϸöÔÂÔÂÄ©×îºóÒ»Ìì
5 select CONVERT(varchar(12),dateadd(ms,-3,DATEADD(mm,DATEDIFF(m,0,getdate()),0)), 112 )
6
7 ......
´ø´æÔÚÁ¿´ÊNOT EXISTSµÄSQLÓï¾äÎÊÌâ
ѧÉú±ístudent (snoѧºÅ snameÐÕÃû sdeptËùÔÚϵ)
¿Î³Ì±ícourse (cno¿Î³ÌºÅ cname¿Î³ÌÃû cpnoÑ¡Ð޿κŠccreditѧ·Ö)
ѧÉúÑ¡¿Î±ísc (sn0ѧºÅ cno¿Î³ÌºÅ grade³É¼¨)
¶ÔÒÔÉϱí½øÐвéÑ°Ñ¡ÐÞÁËÈ«²¿¿Î³ÌµÄѧÉúÐÕÃû
ÓÉÓÚ²»£¬Ã»ÓÐÈ«³ÆÁ¿´Ê£¬¿É½«ÌâÄ¿µÄÒâ˼ת»»ÎªµÈ¼ÛµÄ´æÔÚÁ¿´ÊÐÎʽ£º²éÑ ......