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

SQL select

--desc ±íÃû ÃèÊö±íµÄÄÚÈÝ  
desc emp;
--¼ÓÉÏÊýѧ±í´ïʽºÍÁÐÃû  ""±£³Ö¸ñʽ
select ename "name space", sal*12 year_sal from emp;   
select 2*3 from dual;
select sysdate from dual;
--¿ÕÖµµÄÊýѧ±í´ïʽ ½á¹û¶¼ÊÇ¿ÕÖµ
select ename, sal*12 + comm from emp;  
--"||"×Ö·û´®Á¬½Ó µ¥ÒýºÅÖеÄÊÇ×Ö·û´®£¬×Ö·û´®Öеĵ¥ÒýºÅ£¬''±íʾ
select ename||sal from emp;    
--distinct ÐÞÊÎÁ½¸ö×Ö¶Î
select distinct deptno, job from emp;
select ename, sal from emp where sal between 800 and 1500;
select ename, sal from emp where sal >= 800 and sal <= 1500;
select ename, sal from emp where comm is null;
--Ò»¸öÊÂÎñ¿ªÊ¼ÓÚÒ»ÌõddlÓï¾ä£¬½áÊøÓïrollback commit ddlÊý¾Ý¶¨ÒåÓï¾ä dclÊý¾Ý¿ØÖÆÓï¾äÓï¾ä
--Õý³£¶Ï¿ªÁ¬½Ó Ìá½» ·ÇÕý³£¶Ï¿ªÁ¬½Ó »Ø¹ö
select ename, sal from emp where sal not in (800 ,1500);
-- Ä£ºý²éѯ
select ename, sal from emp where ename like '_A%';
select ename, sal from emp where ename like '%\%%';
--תÒå×Ö·û
select ename, sal from emp where ename like '%$%%' escape '$';
--ÅÅÐò
select * from dept order by deptno desc;
select ename, sal from emp order by deptno asc, ename desc;
--º¯Êý
select lower(ename) from emp;
select substr(ename,1,3) from emp;
select round(23.652, 1) from dual;
select to_char(sal, '$99,999.999') from emp;
select to_char(sal, 'L000,000.000') from emp;
select to_char(hiredate, 'yyyy-mm-dd hh:mi:ss') from emp;
select to_char(sysdate, 'yyyy-mm-dd hh24:mi:ss') from dual;
select ename, hiredate from emp
    where hiredate > to_date('1982-09-11 12:44:44', 'YYYY-MM-DD HH24:MI:SS');
select sal from emp where sal > to_number('$1,250.000', '$9,999.000');
select ename,sal*12 + nvl(comm, 0) from emp;
--×麯Êý  ¶àÐÐÊäÈ룬ֻÓÐÒ»ÐÐÊä³ö select ename, max(sal) from emp; ½á¹û²»Äܱ£Ö¤Ö»ÓÐÒ»ÐÐ
select max(sal) from emp;
select sum(sal) from emp;
select count(distinct deptno) from emp;
--·Ö×麯Êý
select deptno,avg(sal) from emp group by deptno;
select deptno, job, max(sal


Ïà¹ØÎĵµ£º

SQL SERVER ÓëACCESS¡¢EXCELµÄÊý¾Ýת»»

ÊìϤSQL SERVER 2000µÄÊý¾Ý¿â¹ÜÀíÔ±¶¼ÖªµÀ£¬ÆäDTS¿ÉÒÔ½øÐÐÊý¾ÝµÄµ¼Èëµ¼³ö£¬Æäʵ£¬ÎÒÃÇÒ²¿ÉÒÔʹÓÃTransact-SQLÓï¾ä½øÐе¼Èëµ¼³ö²Ù×÷¡£ÔÚTransact-SQLÓï¾äÖУ¬ÎÒÃÇÖ÷ҪʹÓÃOpenDataSourceº¯Êý¡¢OPENROWSET º¯Êý£¬¹ØÓÚº¯ÊýµÄÏêϸ˵Ã÷£¬Çë²Î¿¼SQLÁª»ú°ïÖú¡£ÀûÓÃÏÂÊö·½·¨£¬¿ÉÒÔÊ®·ÖÈÝÒ×µØʵÏÖSQL SERVER¡¢ACCESS¡¢EXCELÊý¾Ýת»»£ ......

AccessºÍSQL2000ÖÐÓï¾äµÄÇø±ð

1 £¬¶ÔÓÚÈÕÆÚ×Ö¶Î×Ö¶Î
access±íʾΪ£º#1981-28-12#
SQLSERVER2000±íʾΪ£º''1981-02-12''
2,SQLÓï¾äÇø±ð£¬select ,update ÔÚ¶Ôµ¥±í²Ù×÷ʱ¶¼²î²»¶à£¬
µ«¶à±í²Ù×÷ʱupdateÓï¾äµÄÇø±ðACCESSÓëSQLSERVERÖеÄUpdateÓï¾ä¶Ô±È:
SQLSERVERÖиüжà±íµÄUpdateÓï¾ä:
Update Tab1
SET a.Name = b.Name
from Tab1 a,Tab2 b
Whe ......

[ÊÕ£] ÓÃsqlite Ö´Ðбê×¼ sql Óï·¨

http://www.umgr.com/blog/PostView.aspx?bpId=36294
 1. Ö´ÐÐsqlÓï¾ä
int sqlite3_exec(sqlite3*£¬ const char *sql£¬ sqlite3_callbacksql Óï·¨
£¬ void *£¬  char **errmsg );
Õâ¾ÍÊÇÖ´ÐÐÒ»Ìõ sql Óï¾äµÄº¯Êý¡£
µÚ1¸ö²ÎÊý²»ÔÙ˵ÁË£¬ÊÇÇ°Ãæopenº¯ÊýµÃµ½µÄÖ¸Õ롣˵ÁËÊǹؼüÊý¾Ý½á¹¹¡£
µÚ2¸ö²ÎÊýconst char ......

¸ßÊÖÏê½âSQLÐÔÄÜÓÅ»¯Ê®Ìõ¾­Ñé

1.²éѯµÄÄ£ºýÆ¥Åä
¾¡Á¿±ÜÃâÔÚÒ»¸ö¸´ÔÓ²éѯÀïÃæʹÓà LIKE '%parm1%'—— ºìÉ«±êʶλÖõİٷֺŻᵼÖÂÏà¹ØÁеÄË÷ÒýÎÞ·¨Ê¹Óã¬×îºÃ²»ÒªÓÃ.
½â¾ö°ì·¨:
ÆäʵֻÐèÒª¶Ô¸Ã½Å±¾ÂÔ×ö¸Ä½ø£¬²éѯËٶȱã»áÌá¸ß½ü°Ù±¶¡£¸Ä½ø·½·¨ÈçÏ£º
a¡¢ÐÞ¸Äǰ̨³ÌÐò——°Ñ²éѯÌõ¼þµÄ¹©Ó¦ÉÌÃû³ÆÒ»À¸ÓÉÔ­À´µÄÎı¾ÊäÈë¸ÄΪÏÂÀ­Áб ......

¼ÆËãÄê×ʵÄSQLÓï¾ä

1.bzscs(ɳ³æ ÎÒ°®Ð¡ÃÀ)Óú¯數µÄºÃ辦·¨:
CREATE    function [dbo].[calc_date](@time smalldatetime,@now smalldatetime)
returns nvarchar(10)
as
begin
declare @year int,@month int,@day int
select @year = datediff(yy,@time,@now)
if  (month(@now)=month(@time)) and (day ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ