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

sqlÓï¾ä»ù±¾²Ù×÷

1.½¨±íÓï¾ä£ºcreate table
Ó÷¨: create table ±íµÄÃû×Ö (×Ö¶Î1, ×Ö¶Î2,¡£¡£¡£¡£)
¾ÙÀý£ºÀýÈç´´½¨Ò»¸öѧÉú³É¼¨±í£¬°üº¬µÄ×Ö¶ÎÓУ¬Ñ§Éúid£¬ÐÕÃû£¬ÐԱ𣬰༶£¬³É¼¨create table score(
create table score(
 sid nvarchar(10) primary key,
 sname nvarchar(10) not null,
 sex nvarchar(2),
 sclass nvarchar(5),
 score int,
 check(sex in('ÄÐ','Å®'))
);
2.²åÈëÓï¾ä£ºinsert into
Ó÷¨:insert into ±íµÄÃû×Ö (×Ö¶Î1, ×Ö¶Î2,¡£¡£¡£¡£) values (Öµ1£¬Öµ2£¬¡£¡£¡£¡£)
Èç¹û×Ö¶ÎÊDZíÖÐËùÓÐ×Ö¶Î×Ö¶ÎÁбí¿ÉÊ¡È¥£¬Ö±½Óд±íÃû¾ÍÐÐÁË
¾ÙÀý:Íù±íscoreÖвåÈë7ÌõÊý¾Ý
insert into score values('95002','СÀî','ÄÐ','01',82)
insert into score values('95003','СÀö','Å®','01',83)
insert into score values('95004','СÕÔ','ÄÐ','01',67)
insert into score values('95005','СÃÀ','Å®','01',78)
insert into score values('95006','СÌï','ÄÐ','01',88)
insert into score values('95007','СÐì','Å®','01',85)
insert into score values('95008','СÍõ','ÄÐ','01',86)
 3.²éѯÓï¾ä£ºselect
Ó÷¨£ºselect ×ֶΠfrom ±íÃû where Ìõ¼þ
×ֶμäÓÃ','·Ö¿ª£¬Í¬ÑùÈç¹ûÑ¡Ôñ±íµÄËùÓÐ×ֶΣ¬¿ÉÓÃͨÅä·û*
¾ÙÀý£ºÊä³öscore±íÖгɼ¨ÔÚ60µ½80µÄͬѧµÄËùÓÐÐÅÏ¢
select * from score where score>=60 and score<=80
Êä³öscore ±íÖгɼ¨Îª85»ò86»ò87µÄѧÉúÐÅÏ¢
select * from score where score=85 or score=86 or score=87
Êä³öscore ±íÖа༶Ϊ95001»òÕßÐÔ±ðΪŮÐÔµÄѧÉúµÄÃû×Ö
select sname from score where sclass='95001' or sec='Å®'
4.ɾ³ýÓï¾ä:delete
Ó÷¨£ºdelete from ±íµÄÃû×Ö where Ìõ¼þ
¾ÙÀý£ºÉ¾³ýscore±íÖзÖÊýµÍÓÚ70·ÖµÄ¼Ç¼
delete from score where score<70


Ïà¹ØÎĵµ£º

ORACLEºÍSQLÓï·¨Çø±ð¹éÄÉ

¹Ø¼ü×Ö: oracle & sql server
Êý¾ÝÀàÐͱȽÏ
ÀàÐÍÃû³Æ
Oracle
SQLServer
±È½Ï
×Ö·ûÊý¾ÝÀàÐÍ CHAR CHAR ¶¼Êǹ̶¨³¤¶È×Ö·û×ÊÁϵ«oracleÀïÃæ×î´ó¶ÈΪ2kb£¬SQLServerÀïÃæ×î´ó³¤¶ÈΪ8kb
±ä³¤×Ö·ûÊý¾ÝÀàÐÍ VARCHAR2 VARCHAR OracleÀïÃæ×î´ó³¤¶ÈΪ4kb£¬SQLServerÀïÃæ×î´ó³¤¶ÈΪ8kb
¸ù¾Ý×Ö·û¼¯¶ø¶¨µÄ¹Ì¶¨³¤¶È×Ö· ......

SQL Server 2008ÖеÄ9ÖÖÊý¾ÝÍÚ¾òËã·¨


ÕªÒª£ºSQL Server 2008ÖÐÌṩÁË9ÖÖ³£ÓõÄÊý¾ÝÍÚ¾òËã·¨£¬ÕâЩËã·¨ÓÃÔÚ²»Í¬Êý¾ÝÍÚ¾òµÄÓ¦Óó¡¾°Ï£¬±¾Îľ͸÷¸öËã·¨Öð¸ö·ÖÎöÌÖÂÛ¡£
±êÇ©£ºÊý¾ÝÍÚ¾òËã·¨  SQL Server 2008
1.¾ö²ßÊ÷Ëã·¨
¾ö²ßÊ÷£¬ÓÖ³ÆÅж¨Ê÷£¬ÊÇÒ»ÖÖÀàËƶþ²æÊ÷»ò¶à²æÊ÷µÄÊ÷½á¹¹¡£¾ö²ßÊ÷ÊÇÓÃÑù±¾µÄÊôÐÔ×÷Ϊ½áµã£¬ÓÃÊôÐÔµÄÈ¡Öµ×÷Ϊ·ÖÖ§£¬Ò²¾ÍÊÇÀàËÆÁ ......

SQL Server2008°¸ÀýÖ®CyberSavvy ¹«Ë¾

CyberSavvy ¼áÐÅÈí¼þ×Ô¶¯»¯¿ÉÒÔÈÿͻ§ÇáËÉÏíÊÜÉú»î¡£DataPlace ÊǸù«Ë¾µÄÈí¼þ¼´·þÎñ½â¾ö·½°¸£¬Ò²¿É³Æ֮Ϊ“Êý¾Ý¿â¹¤³§”£¬ËüÄܹ»ÈÃÃæÏò¼¼ÊõÒÔ¼°ÃæÏòÉÌÎñµÄÓû§´´½¨²¢ÐÞ¸Ä×Ô¼ºµÄÊý¾Ý¿â£¬¶øCyberSavvy ¹«Ë¾½«Îª¸ÃÊý¾Ý¿âÌṩÍйܷþÎñ¡£Òò´ËCyberSavvy ¹«Ë¾ÐèÒªÅÍʯ°ã¼á¹ÌµÄÊý¾Ý¿â£¬²¢Í¨¹ýÍòÎÞһʧµÄÊý¾Ý´«Êä»úÖÆÀ´Ö ......

ÓÃsql»ñȡij×Ö·û´®ÖеÄÊý×Ö²¿·Ö

create function dbo.F_Get_No
(
 @No varchar(100)
)
RETURNS bigint
AS
BEGIN
 WHILE PATINDEX('%[^0-9]%',@No)>0
 BEGIN
  SET @No=STUFF(@No,PATINDEX('%[^0-9]%',@No),1,'') --ɾµôÒ»¸ö·ÇÊý×ÖµÄ×Ö·û£¬Ñ­»·½áÊø£¬Ê£ÓàµÄΪÊý×Ö²¿·Ö
 END
 RETURN CONVERT(bigint,@No ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ