sql Óï¾ä¶Ôʱ¼ä²Ù×÷µÄ×ܽá
ÔÚSQLÓï¾äÖУ¬³£³£Óûá¶Ôʱ¼ä£¨»òÈÕÆÚ£©½øÐÐһЩ´¦Àí£¬ÏÂÃæÊDZȽÏͨÓõÄһЩÓï¾ä£º
ÑÓ³Ù£º
sysdate+(5/24/60/60) ÔÚϵͳʱ¼ä»ù´¡ÉÏÑÓ³Ù5Ãë
sysdate+5/24/60 ÔÚϵͳʱ¼ä»ù´¡ÉÏÑÓ³Ù5·ÖÖÓ
sysdate+5/24 ÔÚϵͳʱ¼ä»ù´¡ÉÏÑÓ³Ù5Сʱ
sysdate+5 ÔÚϵͳʱ¼ä»ù´¡ÉÏÑÓ³Ù5Ìì
add_months(sysdate,-5) ÔÚϵͳʱ¼ä»ù´¡ÉÏÑÓ³Ù5ÔÂ
add_months(sysdate,-5*12) ÔÚϵͳʱ¼ä»ù´¡ÉÏÑÓ³Ù5Äê
ÉÏÔÂÄ©µÄÈÕÆÚ£º
select last_day(add_months(sysdate, -1)) from dual;
±¾ÔµÄ×îºóÒ»Ã룺
select trunc(add_months(sysdate,1),'MM') - 1/24/60/60 from dual
±¾ÖÜÐÇÆÚÒ»µÄÈÕÆÚ£º
select trunc(sysdate,'day')+1 from dual
Äê³õÖÁ½ñµÄÌìÊý£º
select ceil(sysdate - trunc(sysdate, 'year')) from dual;
½ñÌìÊǽñÄêµÄµÚ¼¸ÖÜ :
select to_char(sysdate,'fmww') from dual
½ñÌìÊDZ¾Ôµĵڼ¸ÖÜ:
SELECT TO_CHAR(SYSDATE,'WW') - TO_CHAR(TRUNC(SYSDATE,'MM'),'WW') + 1 AS "weekOfMon" from dual
±¾ÔµÄÌìÊý
SELECT to_char(last_day(SYSDATE),'dd') days from dual
½ñÄêµÄÌìÊý
select add_months(trunc(sysdate,'year'), 12) - trunc(sysdate,'year') from dual
ϸöÐÇÆÚÒ»µÄÈÕÆÚ
SELECT Next_day(trunc(SYSDATE),'monday') from dual
£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½
¼ÆË㹤×÷ÈÕ·½·¨
create table t(s date,e date);
alter session set nls_date_format = 'yyyy-mm-dd';
insert into t values('2003-03-01','2003-03-03');
insert into t values('2003-03-02','2003-03-03');
insert into t values('2003-03-07','2003-03-08');
insert into t values('2003-03-07','2003-03-09');
insert into t values('2003-03-05','2003-03-07');
insert into t values('2003-02-01','2003-03-31');
-- ÕâÀï¼Ù¶¨ÈÕÆÚ¶¼ÊDz»´øʱ¼äµÄ£¬·ñÔòÔÚËùÓÐÈÕÆÚÇ°¼Ótrunc¼´¿É¡£
Ïà¹ØÎĵµ£º
First:
create table gobo.gobo_om_reservations_2008b as
select * from gobo_om_reservations
where to_char(CREATION_DATE,'yyyy')<'2008'
delete from gobo_om_reservations
where to_char(CREATION_DATE,'yyyy')<'2008'
commit
After 2009Year:
create table gobo.gobo_om_reservations_????b as ......
¶Ôhttp request¹ýÀ´µÄÊý¾Ý£¬·²ÊǺ¬Óе¥ÒýºÅ£¬Ë«ÒýºÅ£¬·´Ð±Ïߵȶ¼½øÐмÓбÏß´¦Àí¡£·ÀÖ¹½øÐÐ×¢Èë²Ù×÷¡£
/*
¶ÂSQL©¶´
*/
function quotes($content){
//Èç¹ûmagic_quotes_gpc=Off£¬ÄÇô¾Í¿ªÊ¼´¦Àí
if (!get_magic_quotes_gpc()) {
//ÅжÏ$contentÊÇ·ñΪÊý×é
if (is_array($content)) {
//Èç¹û$contentÊÇ ......
³ÉÔ±Ãû³Æ˵Ã÷
BigInt
Int64¡£64 λµÄÓзûºÅÕûÊý¡£
Binary
Byte ÀàÐ굀 Array¡£¶þ½øÖÆÊý¾ÝµÄ¹Ì¶¨³¤¶ÈÁ÷£¬·¶Î§ÔÚ 1 µ½ 8,000 ¸ö×Ö½ÚÖ®¼ä¡£
Bit
Boolean¡£ÎÞ·ûºÅÊýÖµ£¬¿ÉÒÔÊÇ 0¡¢1 »ò ¿ÕÒýÓã¨ÔÚ Visual Basic ÖÐΪ Nothing£©¡£
Char
String¡£·Ç Unicode ×Ö·ûµÄ¹Ì¶¨³¤¶ÈÁ÷£¬·¶Î§ÔÚ 1 ......
Ò»¡¢ÉîÈëdz³öÀí½âË÷Òý½á¹¹
¡¡¡¡Êµ¼ÊÉÏ£¬Äú¿ÉÒÔ°ÑË÷ÒýÀí½âΪһÖÖÌØÊâµÄĿ¼¡£Î¢ÈíµÄsql serverÌṩÁËÁ½ÖÖË÷Òý£º¾Û¼¯Ë÷Òý£¨clustered index£¬Ò²³Æ¾ÛÀàË÷Òý¡¢´Ø¼¯Ë÷Òý£©ºÍ·Ç¾Û¼¯Ë÷Òý£¨nonclustered index£¬Ò²³Æ·Ç¾ÛÀàË÷Òý¡¢·Ç´Ø¼¯Ë÷Òý£©¡£ÏÂÃ棬ÎÒÃǾÙÀýÀ´ËµÃ÷һϾۼ¯Ë÷ÒýºÍ·Ç¾Û¼¯Ë÷ÒýµÄÇø±ð£º
¡¡¡¡Æäʵ£¬ÎÒÃǵĺºÓï× ......
--Ê¡¼¶ Provincial
--³ÇÊÐ City
create table Provincial(pid int,Provincial varchar(50),primary key (pid))
insert into Provincial values(1,'±±¾©ÊÐ')
insert into Provincial values(2,'Ìì½òÊÐ')
insert into Provincial values(3,'ÉϺ£ÊÐ')
insert into Provincial values(4,'Ö ......