aspÍøÒ³Àï,sql³£ÓòÙ×÷Óï¾ä!
Ìí¼Ó¡¢É¾³ý¡¢ÐÞ¸ÄʹÓÃ
db.Execute(Sql)ÃüÁîÖ´ÐвÙ×÷
╔----------------╗
¡î Êý¾Ý¼Ç¼ɸѡ ¡î
╚----------------╝
×¢Ò⣺µ¥Ë«ÒýºÅµÄÓ÷¨¿ÉÄÜÓÐÎó(ûÓвâʽ)
Sql = "Select
Distinct
×Ö¶ÎÃû from Êý¾Ý±í"
Distinctº¯Êý£¬²éѯÊý¾Ý¿â´æ±íÄÚ²»Öظ´µÄ¼Ç¼
Sql = "Select Count(*) from Êý¾Ý±í where
×Ö¶ÎÃû1>#18:0:0# and ×Ö¶ÎÃû1< #19:00# "
countº¯Êý,²éѯÊý¿â±íÄÚÓжàÉÙÌõ¼Ç¼£¬“×Ö¶ÎÃû1”ÊÇָͬһ×Ö¶Î
Àý£º
set rs=conn.execute("select count(id) as idnum from news")
response.write rs("idnum")
sql="select * from Êý¾Ý±í where ×Ö¶ÎÃû between Öµ1 and
Öµ2"
Sql="select * from Êý¾Ý±í where ×Ö¶ÎÃû between
#2003-8-10# and #2003-8-12#"
ÔÚÈÕÆÚÀàÊýֵΪ2003-8-10 19:55:08
µÄ×Ö¶ÎÀï²éÕÒ2003-8-10ÖÁ2003-8-12µÄËùÓмǼ£¬¶ø²»¹ÜÊǼ¸µã¼¸·Ö¡£
select * from tb_name where datetime between #2003-8-10# and
#2003-8-12#
×Ö¶ÎÀïÃæµÄÊý¾Ý¸ñʽΪ£º2003-8-10
19:55:08£¬Í¨¹ýsql²é³ö2003-8-10ÖÁ2003-8-12µÄËùÓмͼ£¬¶ø²»¹ÜÊǼ¸µã¼¸·Ö¡£
Sql="select * from Êý¾Ý±í where ×Ö¶ÎÃû=×Ö¶ÎÖµ order by
×Ö¶ÎÃû [desc]"
Sql="select * from Êý¾Ý±í where ×Ö¶ÎÃû like ’’%×Ö¶ÎÖµ%’’
order by ×Ö¶ÎÃû [desc]"
Ä£ºý²éѯ
×¢Ò⣺mysqlÓëORACLEÊý¾Ý¿â´æÔÚ²»Í¬
Sql="select
top 10
*
from Êý¾Ý±í where ×Ö¶ÎÃû order by ×Ö¶ÎÃû [desc]"
Sql="select *fromÊý¾Ý±íwhere×Ö¶ÎÃûorder by×Ö¶ÎÃû[desc]
limit
10
"
²éÕÒÊý¾Ý¿âÖÐÇ°10¼Ç¼
Sql="select top n * form Êý¾Ý±í order by newid()"
Ëæ»úÈ¡³öÊý¾Ý¿âÖеÄÈô¸ÉÌõ¼Ç¼µÄ·½·¨
top n£¬n¾ÍÊÇҪȡ³öµÄ¼Ç¼Êý
Sql="select * from Êý¾Ý±í where ×Ö¶ÎÃû in
(’’Öµ1’’,’’Öµ2’’,’’Öµ3’’)"
╔----------------╗
¡î Ìí¼ÓÊý¾Ý¼Ç¼ ¡î
╚----------------╝
sql="insert into Êý¾Ý±í (×Ö¶Î1,×Ö¶Î2,
Ïà¹ØÎĵµ£º
1,ÏÔʾÓαêµÄ²Ù×÷
(1) ¶¨ÒåÓαê
¸ù¾Ý²éѯµÄÊý¾ÝÇé¿ö£¬ÔÚPL/SQL¿éµÄÉùÃ÷²¿·Ö¶¨ÒåÓα꣬Ó﷨Ϊ£º
cursor cursor_name is select_statement;
×¢Ò⣺
Óαê±ØÐëÔÚPL/SQL¿éµÄÉùÃ÷²¿·Ö½øÐж¨Ò壻
......
ÎÒÃÇÔÚÊý¾Ý¿âÖÐʹÓñíµÄʱºò,¾³£»áÓöµ½Á½ÖÖʹÓñíµÄ·½·¨,·Ö±ð¾ÍÊÇʹÓÃÁÙʱ±í¼°±í±äÁ¿¡£ÔÚʵ¼ÊʹÓõÄʱºò£¬ÎÒÃÇÈçºÎÁé»îµÄÔÚ´æ´¢¹ý³ÌÖÐÔËÓÃËüÃÇ£¬ËäÈ»ËüÃÇʵÏֵŦÄÜ»ù±¾ÉÏÊÇÒ»ÑùµÄ£¬¿ÉÈçºÎÔÚÒ»¸ö´æ´¢¹ý³ÌÖÐÓÐʱºòȥʹÓÃÁÙʱ±í¶ø²»Ê¹Óñí±äÁ¿£¬ÓÐʱºòȥʹÓñí±äÁ¿¶ø²»Ê¹ÓÃÁÙʱ±íÄØ?
¡¡¡¡ÁÙʱ±í
¡¡¡¡ÁÙʱ±íÓëÓÀ¾Ã±íÏàËÆ£ ......
/*
2008 ѹËõ
ÐÐѹËõ
SQL SERVER 2008 Òý½øÁËÐÐѹËõÕâ¸öÐÂÌØÐÔ,Ö»ÓÐÆóÒµ°æ¾ßÓиÃÐÂÌØÐÔ.ÐÐѹËõÖ»ÐèÒª×îµÍµÄ¿Õ¼ä¶ÔÐÐÊý¾Ý½øÐÐѹËõ.ÐÐѹËõ¿ÉÒÔÔÚCREATEÒ»¸ö±í,Ë÷Òý»òÕßALTERÒ»¸ö±í,Ë÷ÒýµÄʱºò½øÐд´½¨.ѹËõ¿ÉÒÔÔÚ ......
/*
±êÌ⣺һ¸öÏîÄ¿Éæ¼°µ½µÄ50¸öSqlÓï¾ä(ÕûÀí°æ)
×÷Õߣº°®Ð¾õÂÞ.ع»ª(Ê®°ËÄê·çÓ꣬ÊصñùɽѩÁ«»¨¿ª)
ʱ¼ä£º2010-05-10
µØµã£ºÖØÇ캽ÌìְҵѧԺ
˵Ã÷£ºÒÔÏÂÎåÊ®¸öÓï¾ä¶¼°´ÕÕ²âÊÔÊý¾Ý½øÐйý²âÊÔ£¬×îºÃÿ´ÎÖ»µ¥¶ÀÔËÐÐÒ»¸öÓï¾ä¡£
ÎÊÌâ¼°ÃèÊö£º
--1.ѧÉú±í
Student(S#,Sname,Sage,Ssex) --S# ѧÉú±àºÅ,Sname ѧÉúÐÕÃû,S ......
<%
'ÒÔÏÂÊÇÊÔÓðæ´úÂ룬Êǹ̶¨µÄ´úÂ룬ֻÓÐÕýʽ°æ²Å¿É×Ô¶¯´Óºǫ́Êý¾Ý¿âÖжÁȡͼƬ¡£
piao1="images/1.jpg"
piao1url=""
piaos1="ͼ1"
piao2="images/2.jpg"
piao2url=""
piaos2="ͼ2"
piao3="images/ ......