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

SQL ֪ʶ

--------------------------------²éѯϵͳ¿âÖÐÊÇ·ñÓп⣨Óпâ¾Íɾ³ý´Ë¿â£©----------------------------------------------------
use master
if exists(select * from databases where name='¿âÃû')
drop database ¿âÃû
__________________________  ½¨Êý¾Ý¿â½¨±íµÄ»ù±¾¸ñʽ  ___________________________________________
create database ¿âÃû
on primary
(name='student1',filename='·¾¶\student1.mdf',size=10mb, filegrowth=15%),                Ö÷Îļþ
(name='student2',filename='·¾¶\student2.ndf',size=10mb, filegrowth=15%)                 ´ËÎļþ
log on
(name='student1_log',filename='·¾¶\student1.ldf',size=1mb,filegrowth=15%,maxsize=300mb),   ÈÕÖ¾Îļþ
(name='student2_log',filename='·¾¶\student2.ldf',size=1mb,filegrowth=15%,maxsize=300mb)
go
use ¿âÃû
create table ±íÃû
(ÁÐÃû1 Êý¾ÝÀàÐÍ Ö÷¼ü ÊÇ·ñÔö³¤ Ψһ  Ä¬ÈÏ  ÊÇ·ñΪ¿Õ£¬
name varchar  primary key  identity(±íʾÖÖ×Ó£¬Ôö³¤Á¿) unique default  not null,
)
-------------------------½¨Êý¾Ý¿â±íÖ®¼äµÄÔ¼Êø-------------------------------------------------------
            alter table kk add
df ĬÈÏ       constraint  df_sex default(nan) for sex
pk Ö÷¼ü       constraint  pk_ÁÐÃû  primary key(ÁÐÃû)
ck ¼ì²é       constraint  ck_ÁÐÃû  check(len(ÁÐÃû)>=6)
              constraint  ck_ÁÐÃû  check(ÁÐÃû like [email='%@%']'%@%'[/email])
fk Ö÷Íâ¼ü     constraint  fk_Íâ¼üÁÐÃû foreign key(Íâ¼üÁÐÃû) references Ö÷±íÃû£¨Ö÷±íÁУ©
      
uq Ψһ  


Ïà¹ØÎĵµ£º

ÈýÖÖsql·ÖÒ³·½·¨

±íÖÐÖ÷¼ü±ØÐëΪ±êʶÁУ¬[ID] int IDENTITY (1,1)
1.·ÖÒ³·½°¸Ò»£º(ÀûÓÃNot InºÍSELECT TOP·ÖÒ³)
Óï¾äÐÎʽ£º 
SELECT TOP Ò³¼Ç¼ÊýÁ¿ *
from ±íÃû
WHERE (ID NOT IN
  (SELECT TOP (ÿҳÐÐÊý*(Ò³Êý-1)) ID
  from ±íÃû
  ORDER BY ID))
  ORDER BY ID
//×Ô¼º»¹¿ÉÒÔ¼ÓÉÏһЩ²éѯ ......

ÈÃpowerdesignerÉú³ÉµÄsqlÔÚmysqlÏÂÕýÈ·ÔËÐÐ

Èç¹û°´ÕÕpowerdesignerµÄĬÈÏÑ¡Ïî,Éú³ÉµÄsql²»ÄÜÔÚmysqlÖÐÕýÈ·ÔËÐÐ.]
¾­¹ý±¾ÈËÑо¿·¢ÏÖÒª×öÈçÏÂÐÞ¸Ä:
  1.aftercreateÑ¡Ïî¸ÄΪ
.foreach_item(OutReferences)
   .ifnot (%hasFKIndex%)
/*==============================================================*/
/* Index: ......

OracleÖÐÓÅ»¯SQLµÄÔ­Ôò

.Frm644 { display:none; }
¡¡¡¡1¡£ÒѾ­¼ìÑéµÄÓï¾äºÍÒÑÔÚ¹²Ïí³ØÖеÄÓï¾äÖ®¼äÒªÍêÈ«Ò»Ñù
¡¡¡¡2¡£±äÁ¿Ãû³Æ¾¡Á¿Ò»ÖÂ
¡¡¡¡3¡£ºÏÀíʹÓÃÍâÁª½Ó
¡¡¡¡4¡£ÉÙ
Óöà²ãǶÌ×
¡¡¡¡5¡£¶àÓò¢·¢
¡¡¡¡
¡¡¡¡Óï¾äµÄÓÅ»¯²½ÖèÒ»°ãÓУº
¡¡¡¡1¡£µ÷ÕûsgaÇø£¬Ê¹µÃsgaÇøµÄÊÇÓÃ×îÓÅ¡£
¡¡
¡¡2¡£sqlÓï¾ä±¾ÉíµÄÓÅ»¯£¬¹¤¾ßÓÐexplain,sql trace ......

mysql Ò»ÌõsqlÓï¾äupdate¸üÐÂÁ½¸ö±í

Äãд¹ýÒ»ÌõsqlÓï¾äÀ´ÐÞ¸ÄÁ½¸ö±íµÄÊý¾ÝÂð£¿
UPDATE test.table1 t1,test.table2 t2 SET t1.aa='a',t1.bb='b',t2.cc='c',WHERE t1.u_id=t2.u_id AND t1.u_id='1'  £»
table1µÄu_idºÍtable2µÄu_idÊÇÖ÷Íâ¼ü¹Øϵ ......

Oracle:PL/SQL ÖÐÈçºÎʹÓÃArray

http://tech.163.com/05/0701/10/1NIODMQS00091589.html
ÒòΪÔÚPL/SQL Öв¢Ã»ÓÐÊý×é.
ÕâÊÇż²é×ÊÁÏÕҵķ¶ÀýºÍ×Ô¼ºÐ´µÄ·¶ÀýÀ´½âÊÍÈçºÎÔÚPL/SQL ÖÐʹÓÃÊý×é. Ò²ÐíºÜ¶àÈËÒÑÖªµÀ, ²»¹ý¾ÍÊÇÈò»ÖªµÀµÄÅóÓÑÃÇÁ˽âһϰɡ£
----------------------
µ¥Î¬Êý×é
------------------------
DECLARE
TYPE
emp_ssn_array IS TA ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ