С²¼×÷Æ·£ºOracle 11g SQL»ù´¡ÈëÃÅϵÁÐÅàѵ(È«30½²)
==============================================
µÚ01½²: Chapter 00--Oracle 11g SQL Fundamentals Training Introduction
ÔÚÏß¹Û¿´£º http://www.boobooke.com/v/bbk2003
ÊÓƵÏÂÔØ£º http://www.boobooke.com/v/bbk2003.zip
µÚ02½²: Chapter 00--Oracle 11g SQL Fundamentals Training Introduction
ÔÚÏß¹Û¿´£º http://www.boobooke.com/v/bbk2004
ÊÓƵÏÂÔØ£º http://www.boobooke.com/v/bbk2004.zip
µÚ03½²: Chapter 01--Restricting Data Using the SQL SELECT Statement
ÔÚÏß¹Û¿´£º http://www.boobooke.com/v/bbk2005
ÊÓƵÏÂÔØ£º http://www.boobooke.com/v/bbk2005.zip
µÚ04½²: Chapter 01--Restricting Data Using the SQL SELECT Statement
ÔÚÏß¹Û¿´£º http://www.boobooke.com/v/bbk2006
ÊÓƵÏÂÔØ£º http://www.boobooke.com/v/bbk2006.zip
µÚ05½²: Chapter 02--Restricting and Sorting Data
ÔÚÏß¹Û¿´£º http://www.boobooke.com/v/bbk2008
ÊÓƵÏÂÔØ£º http://www.boobooke.com/v/bbk2008.zip
µÚ06½²: Chapter 02--Restricting and Sorting Data
ÔÚÏß¹Û¿´£º http://www.boobooke.com/v/bbk2009
ÊÓƵÏÂÔØ£º http://www.boobooke.com/v/bbk2009.zip
µÚ07½²: Chapter 02--Restricting and Sorting Data
ÔÚÏß¹Û¿´£º http://www.boobooke.com/v/bbk2021
ÊÓƵÏÂÔØ£º http://www.boobooke.com/v/bbk2021.zip
µÚ08½²: Chapter 03--Using Single-Row Functions to Customize Output
ÔÚÏß¹Û¿´£º http://www.boobooke.com/v/bbk2022
ÊÓƵÏÂÔØ£º http://www.boobooke.com/v/bbk2022.zip
µÚ09½²: Chapter 03--Using Single-Row Functions to Customize Output
ÔÚÏß¹Û¿´£º http://www.boobooke.com/v/bbk2023
ÊÓƵÏÂÔØ£º http://www.boobooke.com/v/bbk2023.zip
µÚ10½²: Chapter 04--Using Conversion Functions and conditional Expressions
ÔÚÏß¹Û¿´£º http://www.boobooke.com/v/bbk2024
ÊÓƵÏÂÔØ£º http://www.boobooke.com/v/bbk2024.zip
µÚ11½²: Chapter 04--Using Conversion Functions and conditional Expressions
ÔÚÏß¹Û¿´£º http://www.boobooke.com/v/bbk2025
ÊÓƵÏÂÔØ£º http://www.boobooke.com/v/bbk2025.zip
µÚ12½²: Chapter 05--Reporting Aggregated Data Using the Group Functions
ÔÚÏß¹Û¿
Ïà¹ØÎĵµ£º
from: http://blog.163.com/ck275601774/blog/static/1230468012009631113559291/
--ÈÕÆÚת»»²ÎÊý
select CONVERT(varchar,getdate(),120)
--2009-03-15 15:10:02
select replace(replace(replace(CONVERT(varchar, getdate(), 120 ),'-',''),' ',''),':','')
--20090315151201
select CONVERT(varchar(12) , getdate ......
Óï¾äÐÎʽ£º¡¡ SELECTTOP10*
fromTestTable
WHERE(ID>
¡¡¡¡¡¡¡¡¡¡(SELECTMAX(id)
¡¡¡¡¡¡¡¡from(SELECTTOP20id
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡fromTestTable
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ORDERBYid)AST))
ORDERBYID
SELECTTOPÒ³´óС*
fromTestTable
WHERE(ID>
¡¡¡¡¡¡¡¡¡¡(SELECTMAX(id)
¡¡¡¡¡¡¡¡from(SELECTTOPÒ³´óС*Ò³Êýid
¡¡¡¡¡ ......
if exists(select 1 from sysobjects where name='char_index')
drop function char_index
create function char_index(@string varchar(8000),@char varchar(10),@index smallint)
--@string:´ý²éÕÒ×Ö·û´®£¬@index:²éÕÒλÖÃ
returns smallint
as
begin
declare
@i tinyint,--µ±Ç°ÕÒµ½µÚ@i¸ö
  ......
¼ò½é
ÔÚÕâƪÎÄÕÂÖУ¬ÎÒÁоÙһЩsqlÓï¾äÀ´½éÉÜÊý¾Ý¿â£¬Êý¾Ý±í£¬ÊÓͼµÈµÈ¡£µ±ÎÒÃÇÔÚʹÓòéѯ²éѯ²Ù×÷ʱÕâЩsqlÓï¾ä¶¼ÊǷdz£ÓÐÓõġ£ËäÈ»ÔÚsql server¶ÔÏóä¯ÀÀÆ÷ÖÐÎÒÃÇÒ²¿ÉÒÔ»ñµÃÕâЩÓï¾ä£¬µ«ÊÇÈç¹ûÎÒÃÇдÕâЩÓï¾äʱÎÒÃÇ¿ÉÒÔ½«Ëü×Ô¶¨Òå¡£Õâ¾ÍÒâζ×ÅÎÒÃÇ¿ÉÒÔ¸øÓè×Ô¼ºµÄÐèÇóÀ´¹ýÂ˽á¹û¡£
sqlÓï¾äÁбí
ÈçºÎÁоÙsql serverµ±Ç°Á ......
¶ÔÓÚsqlÖеĺ¯Êý¿ÉνÊǶàµÄ²»Ê¤Ã¶¾Ù£¬±¾ÎÄ´Ó³£Óú¯ÊýµÄ½Ç¶È¶ÔÆ亯Êý½øÐÐ×ܽ᣺1¡¢ÈÕÆÚºÍʱ¼äº¯Êý2¡¢×Ö·û´®º¯Êý3¡¢ÏµÍ³º¯ÊýÁ÷³Ì¿ØÖÆÓï¾ä
1¡¢ ÈÕÆÚºÍʱ¼äº¯Êý
¶ÔÓÚÈÕÆÚº¯ÊýÎÒÃÇ¿ÉÒÔ·ÖΪ2СÀà½øÐзÖÎö´¦Àí£¬
A¡¢ ÈÕÆÚµÄÕûÌå´¦Àíº¯Êý£¬¾ßÌåµÄº¬ÒåºÍÓï·¨ÈçÏÂËùʾ£º
DATEADD(datepart,number,date)
µÚÒ»¸ö²ÎÊý˵Ã÷ÒªÌí ......