Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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,


Ïà¹ØÎĵµ£º

SQL ServerÖÐÁÙʱ±íÓë±í±äÁ¿µÄÇø±ð

ÎÒÃÇÔÚÊý¾Ý¿âÖÐʹÓñíµÄʱºò,¾­³£»áÓöµ½Á½ÖÖʹÓñíµÄ·½·¨,·Ö±ð¾ÍÊÇʹÓÃÁÙʱ±í¼°±í±äÁ¿¡£ÔÚʵ¼ÊʹÓõÄʱºò£¬ÎÒÃÇÈçºÎÁé»îµÄÔÚ´æ´¢¹ý³ÌÖÐÔËÓÃËüÃÇ£¬ËäÈ»ËüÃÇʵÏֵŦÄÜ»ù±¾ÉÏÊÇÒ»ÑùµÄ£¬¿ÉÈçºÎÔÚÒ»¸ö´æ´¢¹ý³ÌÖÐÓÐʱºòȥʹÓÃÁÙʱ±í¶ø²»Ê¹Óñí±äÁ¿£¬ÓÐʱºòȥʹÓñí±äÁ¿¶ø²»Ê¹ÓÃÁÙʱ±íÄØ?
¡¡¡¡ÁÙʱ±í
¡¡¡¡ÁÙʱ±íÓëÓÀ¾Ã±íÏàËÆ£ ......

SQL Default Ô¼Êø£¡

´´½¨Ò»ÕÅ±í£¬Ö±½ÓÔÚ±íÁÐÉÏ°ó¶¨Ä¬ÈÏÖµ
CREATE TABLE hello
(
Id_P int PRIMARY KEY,
Firstname varchar(50) DEFAULT 'Bush',
Lastname varchar(50) DEFAULT 'Green',
Address varchar(50) DEFAULT 'China',
City varchar(50) DEFAULT 'beijing'
)
²åÈëÒ»ÌõÐÅÏ¢
INSERT INTO hello(Id_P) values(01)
½á¹ûÊÇ
×ܽ ......

×ÔÔö×ֶεÄSQLÓï¾ä½â¾ö·½°¸

create table [±íÃû]
(
[×Ô¶¯±àºÅ×Ö¶Î] int IDENTITY (1,1) PRIMARY KEY ,
[×Ö¶Î1] nVarChar(50) default 'ĬÈÏÖµ' null ,
[×Ö¶Î2] ntext null ,
[×Ö¶Î3] datetime,
[×Ö¶Î4] money null ,
[×Ö¶Î5] int default 0,
[×Ö¶Î6] Decimal (12,4) default 0,
[×Ö¶Î7] image null ,
)
ɾ³ý±í£º
Drop table [ ......

QtÊý¾Ý¿â£¨Èý£©ÀûÓÃQSqlQueryÀàÖ´ÐÐSQLÓï¾ä£¨Ò»£©


±¾ÎÄÕÂÔ­´´ÓÚwww.yafeilinux.com ×ªÔØÇë×¢Ã÷³ö´¦¡£
SQL¼´½á¹¹»¯²éѯÓïÑÔ£¬ÊǹØϵÊý¾Ý¿âµÄ±ê×¼ÓïÑÔ¡£Ç°ÃæÒѾ­Ìáµ½£¬ÔÚQtÖÐÀûÓÃQSqlQueryÀàʵÏÖÁËÖ´ÐÐSQLÓï¾ä¡£ÐèҪ˵Ã÷£¬ÎÒÃÇÕâÀïÖ»ÊÇQt½Ì³Ì£¬¶ø·ÇרҵµÄÊý¾Ý¿â½Ì³Ì£¬ËùÒÔÎÒÃDz»»á¶ÔÊý¾Ý¿âÖеÄһЩ֪ʶ½øÐÐÉîÈë½²½â£¬ÏÂÃæÖ»ÊǶÔ×î³£Óõļ¸¸ö֪ʶµã½øÐн²½â¡£
ÎÒÃÇÏÂÃ ......

asp´ÓÊý¾Ý¿âÖÐÊä³öµÄ¶«Î÷»»ÐÐ

 <%  
Set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from 0791idc_News where BigClassName='¼Ò×°¿ÎÌÃ' order by ID desc"
rs.Open sql,Conn,1,1
if rs.eof and rs.bof then
  response.Write("ÔÝʱûÓмǼ")
else
%>
         ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ