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

sql Óï¾ä

select * from pet;
insert into pet values('Liujingwei','Liuchao','cat','f','1984-04-18',null);
UPDATE pet set birth='1989-08-31' WHERE name='Slim';
select * from pet WHERE birth>'1998-1-1';
SELECT * from pet WHEREselect * from pet;
insert into pet values('Liujingwei','Liuchao','cat','f','1984-04-18',null);
UPDATE pet set birth='1989-08-31' WHERE name='Slim';
select * from pet WHERE birth>'1998-1-1';
SELECT * from pet WHERE species='dog' and sex='f';
select * from pet WHERE species='snake' or species='cat';
SELECT * from pet WHERE (species='cat' and sex='m') or (species='dog' and sex='f');
SELECT name,birth from pet;
SELECT owner from pet;
SELECT distinct owner from pet;
SELECT name,species,birth from pet where species='dog' or species='cat';
=======================================================================
select name,birth from pet ORDER BY birth;
select    name,birth from pet order by birth desc;
select name,species,birth from pet order by species,birth desc;
========================================================================
select name,birth,curdate(),(year(curdate())-year(birth))-(right(curdate(),5)<right(birth,5)) as age from pet order by name;
select name,birth,curdate(),(year(curdate())-year(birth))-(right(curdate(),5)<right(birth,5)) as age from pet order by age;
select name,birth,curdate(),(year(curdate())-year(birth))-(right(curdate(),5)<right(birth,5)) as age from pet WHERE death IS NOT NULL ORDER BY age;
select name,birth ,month(birth) from pet;
SELECT name, birth from pet WHERE MONTH(birth) = 5;
SELECT name, birth from pet WHERE MONTH(birth) = MONTH(DATE_ADD(CURDATE(),INTERVAL 1 MONTH));
SELECT name, birth from pet WHERE MONTH(birth) = MOD(MONTH(CURDATE()), 12) + 1;
select 1 is null,1 is not null;
select 0 is null, 0 is not null,'' is null,'' is not null;
SELECT * from pet WHERE name LIKE 'b%';
SELECT * from pet WHERE name LIKE '%fy';
SELECT * from pet WHERE name LIKE '%w%';
SELEC


Ïà¹ØÎĵµ£º

OracleÖ´ÐÐSQLÓï¾äµÄ¹ý³Ì

µ±ÎÒÃÇÌá½»Ò»ÌõsqlÓï¾äʱ£¬oracle»á×öÄÄЩ²Ù×÷ÄØ£¿
Oracle»áΪÿ¸öÓû§½ø³Ì·ÖÅäÒ»¸ö·þÎñÆ÷½ø³Ì£ºservice process£¨Êµ¼ÊÇé¿öÓ¦¸ÃÇø·ÖרÓ÷þÎñÆ÷ºÍ¹²Ïí·þÎñÆ÷£©£¬µ±service process½ÓÊÕµ½Óû§½ø³ÌÌá½»µÄsqlÓï¾äʱ£¬·þÎñÆ÷½ø³Ì»á¶ÔsqlÓï¾ä½øÐÐÓï·¨ºÍ´Ê·¨·ÖÎö¡£
Ãû´Ê½âÊÍ£º
Óï·¨·ÖÎö£ºÓï¾ä±¾ÉíÕýÈ·ÐÔ¡£
´Ê·¨·ÖÎö£º¶ÔÕÕÊ ......

¾­µäSQLÓï¾ä´óÈ«

ÏÂÁÐÓï¾ä²¿·ÖÊÇMssqlÓï¾ä£¬²»¿ÉÒÔÔÚaccessÖÐʹÓá£
¡¡¡¡SQL·ÖÀࣺ
¡¡¡¡DDL—Êý¾Ý¶¨ÒåÓïÑÔ(CREATE£¬ALTER£¬DROP£¬DECLARE)
¡¡¡¡DML—Êý¾Ý²Ù×ÝÓïÑÔ(SELECT£¬DELETE£¬UPDATE£¬INSERT)
¡¡¡¡DCL—Êý¾Ý¿ØÖÆÓïÑÔ(GRANT£¬REVOKE£¬COMMIT£¬ROLLBACK)
¡¡¡¡Ê×ÏÈ,¼òÒª½éÉÜ»ù´¡Óï¾ä£º
¡¡¡¡1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿â
......

SQLÎÞÏÞ·ÖÀà´æ´¢¹ý³ÌÕûÀí1

Óŵã:×ֶνÏÉÙ£¬ÓÐÔöɾ¸Ä²é¹¦ÄÜ£¬²»¹ý²éѯ̫Áýͳ¡£
ȱµã:
1.²»ËãÊÇÔÚºÜÕýµÄÎÞÏÞ·ÖÀà,ClassPathÕâ¸ö×ֶζ¨ÒåÏÞÖÆ¡£
2.Ö÷¼üCLASSID²»ÊÇ×ÔÔöµÄ£¬Ê¹ÓÃCODESMITHÅúÁ¿Éú³É¶à²ã¼Ü¹¹´úÂëÖлᵼÖ³ö´í¡£
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ArticleClass]') and OBJECTPROPERTY(id, N'IsUse ......

CSVÎļþµ¼Èëµ½SQL Server 2005Êý¾Ý¿âÖÐ

Ê×ÏÈÓòéѯÓï¾ä£¬´ÓtblTask±íÖвéѯ³öËùÓеÄÊý¾Ý£¬È»ºó½«Æä±£´æΪcsv¸ñʽ¡£
ÔÚSQLÓï¾ä´°¿Ú£¬ÊäÈëÈçÏÂÄÚÈÝ£º
USE Keii BULK INSERT      dbo.tblTask
                      & ......

SQLµ±Ç°ÈÕÆÚ»ñÈ¡¼¼ÇÉ

SQLµ±Ç°ÈÕÆÚ»ñÈ¡¼¼ÇÉ
select   getdate()   //2003-11-07   17:21:08.597    
  select   convert(varchar(10),   getdate(),120)   //2003-11-07  
  select   convert(char(8),getdate(),112)  ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ