-
Êý¾Ý¿â½¨±í£¨×ª£©
2009-04-22 21:04:05
sql½¨¿â½¨±í ´´½¨ºÍʹÓÃÔ¼Êø ¡¡ÈÕÆÚ£º2005-12-4 14:41:58 À´Ô´:°Ùµ±Èí¼þÔ°
Ô¼Êø£¨Constraint£©ÊÇMicrosoft SQL Server ÌṩµÄ×Ô¶¯±£³ÖÊý¾Ý¿âÍêÕûÐÔµÄÒ»ÖÖ·½·¨£¬¶¨ÒåÁË¿ÉÊäÈë±í»ò±íµÄµ¥¸öÁÐÖеÄÊý¾ÝµÄÏÞÖÆÌõ¼þ£¨ÓйØÊý¾ÝÍêÕûÐԵĽéÉÜÇë²Î¼ûµÚ9 Õ£©¡£ÔÚSQL Server ÖÐÓÐ5 ÖÖÔ¼Êø£ºÖ÷¹Ø¼ü×ÖÔ¼Êø£¨Primary Key Constraint£©¡¢Íâ¹Ø¼ü×ÖÔ¼Êø£¨Foreign Key Constraint£©¡¢Î©Ò»ÐÔÔ¼Êø£¨Unique Constraint£©¡¢¼ì²éÔ¼Êø£¨Check Constraint£©ºÍȱʡԼÊø£¨Default Constraint£©¡£7.2.1 Ö÷¹Ø¼ü×ÖÔ¼Êø
Ö÷¹Ø¼ü×ÖÔ¼ÊøÖ¸¶¨±íµÄÒ»Áлò¼¸ÁеÄ×éºÏµÄÖµÔÚ±íÖоßÓÐΩһÐÔ£¬¼´ÄÜΩһµØÖ¸¶¨Ò»ÐмǼ¡£Ã¿¸ö±íÖÐÖ»ÄÜÓÐÒ»Áб»Ö¸¶¨ÎªÖ÷¹Ø¼ü×Ö£¬ÇÒIMAGE ºÍTEXT ÀàÐ͵ÄÁв»Äܱ»Ö¸¶¨ÎªÖ÷¹Ø¼ü×Ö£¬Ò²²»ÔÊÐíÖ¸¶¨Ö÷¹Ø¼ü×ÖÁÐÓÐNULL ÊôÐÔ¡£
¶¨ÒåÖ÷¹Ø¼ü×ÖÔ¼ÊøµÄÓï·¨ÈçÏ£º
CONSTRAINT constraint_name
PRIMARY KEY [CLUSTERED | NONCLUSTERED]
£¨column_name1[, column_name2,¡,column_name16]£©
¸÷²ÎÊý˵Ã÷ÈçÏ£º
constraint_name
Ö¸¶¨Ô¼ÊøµÄÃû³ÆÔ¼ÊøµÄÃû³Æ¡£ÔÚÊý¾Ý¿âÖÐÓ¦ÊÇΩһµÄ¡£Èç¹û²»Ö¸¶¨£¬Ôòϵͳ»á×Ô¶¯Éú³ÉÒ»¸öÔ¼ÊøÃû¡£
CLUSTERED | NONCLUSTERED
Ö¸¶¨Ë÷ÒýÀà±ð£¬CLUSTERED Ϊȱʡֵ¡£Æä¾ßÌåÐÅÏ¢Çë²Î¼ûÏÂÒ»Õ¡£
column_name
Ö¸¶¨×é³ÉÖ÷¹Ø¼ü×ÖµÄÁÐÃû¡£Ö÷¹Ø¼ü×Ö×î¶àÓÉ16 ¸öÁÐ×é³É¡£
Àý7-3£º ´´½¨Ò»¸ö²úÆ·ÐÅÏ¢±í£¬ÒÔ²úÆ·±àºÅºÍÃû³ÆΪÖ÷¹Ø¼ü×Ö
create table products (
p_id char(8) not null,
p_name char(10) not null ,
price money default 0.01 ,
quantity smallint null ,
constraint pk_p_id primary key (p_id, p_name)
) on [primary]7.2.2 Íâ¹Ø¼ü×ÖÔ¼Êø
Íâ¹Ø¼ü×ÖÔ¼Êø¶¨ÒåÁ˱íÖ®¼äµÄ¹Øϵ¡£µ±Ò»¸ö±íÖеÄÒ»¸öÁлò¶à¸öÁеÄ×éºÏºÍÆäËü±íÖеÄÖ÷¹Ø¼ü×Ö¶¨ÒåÏàͬʱ£¬¾Í¿ÉÒÔ½«ÕâЩÁлòÁеÄ×éºÏ¶¨ÒåΪÍâ¹Ø¼ü×Ö£¬²¢É趨ËüÊʺÏÄĸö±íÖÐÄÄЩÁÐÏà¹ØÁª¡£ÕâÑù£¬µ±ÔÚ¶¨ÒåÖ÷¹Ø¼ü×ÖÔ¼ÊøµÄ±íÖиüÐÂÁÐÖµ£¬Ê±ÆäËü±íÖÐÓÐÓëÖ®Ïà¹ØÁªµÄÍâ¹Ø¼ü×ÖÔ¼ÊøµÄ±íÖеÄÍâ¹Ø¼ü×ÖÁÐÒ²½«±»ÏàÓ¦µØ×öÏàͬµÄ¸üС£Íâ¹Ø¼ü×ÖÔ¼ÊøµÄ×÷Óû¹ÌåÏÖÔÚ£¬µ±Ïòº¬ÓÐÍâ¹Ø¼ü×ֵıí²åÈëÊý¾Ýʱ£¬Èç¹ûÓëÖ®Ïà¹ØÁªµÄ±íµÄÁÐÖÐÎÞÓë²åÈëµÄÍâ¹Ø¼ü×ÖÁÐÖµÏàͬµÄֵʱ£¬ÏµÍ³»á¾Ü¾ø²åÈëÊý¾Ý¡£ÓëÖ÷¹Ø¼ü×ÖÏàͬ£¬²»ÄÜʹÓÃÒ»¸ö¶¨ÒåΪ TEXT »òIMAGE Êý¾ÝÀàÐ͵ÄÁд´½¨Íâ¹Ø¼ü×Ö¡£Íâ¹Ø¼ü×Ö×î¶àÓÉ16 ¸öÁÐ×é³É¡£
¶¨ÒåÍâ¹Ø¼ü×ÖÔ¼ÊøµÄÓï·¨ÈçÏ£º
CONSTRAINT constraint_name
FOREIGN KEY £¨column_name1[, column_name2,¡,column_name16]£©
REFERENCES ref_table [ £¨ref_column1[,ref_column2,¡, ref_column16] £©]
[ ON DELETE { CASCADE | NO ACTION } ]
[ ON UPDATE { CASCADE | NO ACTION } ] ]
[ NOT FOR REPLICATION ]
¸÷²ÎÊý˵Ã÷ÈçÏ£ºREFERENCES
Ö¸¶¨Òª½¨Á¢¹ØÁªµÄ±íµÄÐÅÏ¢¡£
ref_table
Ö¸¶¨Òª½¨Á¢¹ØÁªµÄ±íµÄÃû³Æ¡£
ref_column
Ö¸¶¨Òª½¨Á¢¹ØÁªµÄ±íÖеÄÏà¹ØÁеÄÃû³Æ¡£
ON DELETE {CASCADE | NO ACTION}
Ö¸¶¨ÔÚɾ³ý±íÖÐÊý¾Ýʱ£¬¶Ô¹ØÁª±íËù×öµÄÏà¹Ø²Ù×÷¡£ÔÚ×Ó±íÖÐÓÐÊý¾ÝÐÐÓ븸±íÖеĶÔÓ¦Êý¾ÝÐÐÏà¹ØÁªµÄÇé¿öÏ£¬Èç¹ûÖ¸¶¨ÁËÖµCASCADE£¬ÔòÔÚɾ³ý¸¸±íÊý¾ÝÐÐʱ»á½«×Ó±íÖжÔÓ¦µÄÊý¾ÝÐÐɾ³ý£»Èç¹ûÖ¸¶¨µÄÊÇNO ACTION£¬ÔòSQL Server »á²úÉúÒ»¸ö´íÎ󣬲¢½«¸¸±íÖеÄɾ³ý²Ù×÷»Ø¹ö¡£NO ACTION ÊÇȱʡֵ¡£
ON UPDATE {CASCADE | NO ACTION}
Ö¸¶¨ÔÚ¸üбíÖÐÊý¾Ýʱ£¬¶Ô¹ØÁª±íËù×öµÄÏà¹Ø²Ù×÷¡£ÔÚ×Ó±íÖÐÓÐÊý¾ÝÐÐÓ븸±íÖеĶÔÓ¦Êý¾ÝÐÐÏà¹ØÁªµÄÇé¿öÏ£¬Èç¹ûÖ¸¶¨ÁËÖµCASCADE£¬ÔòÔÚ¸üи¸±íÊý¾ÝÐÐʱ»á½«×Ó±íÖжÔÓ¦µÄÊý¾ÝÐиüУ»Èç¹ûÖ¸¶¨µÄÊÇNO ACTION£¬ÔòSQL Server »á²úÉúÒ»¸ö´íÎ󣬲¢½«¸¸±íÖеĸüвÙ×÷»Ø¹ö¡£NO ACTION ÊÇȱʡֵ¡£
NOT FOR REPLICATION
Ö¸¶¨ÁеÄÍâ¹Ø¼ü×ÖÔ¼ÊøÔÚ°Ñ´ÓÆäËü±íÖи´ÖƵÄÊý¾Ý²åÈëµ½±íÖÐʱ²»·¢Éú×÷Óá£
Àý7-4£º´´½¨Ò»¸ö¶©»õ±í£¬ÓëÇ°Ãæ´´½¨µÄ²úÆ·±íÏà¹ØÁª
create table orders(
order_id char(8),
p_id char(8),
p_name char(10) ,
constraint pk_order_id primary key (order_id) ,
foreign key(p_id, p_name) references products(p_id, p_name)
) on [primary]
×¢Ò⣺ÁÙʱ±í²»ÄÜÖ¸¶¨Íâ¹Ø¼ü×ÖÔ¼Êø¡£
7.2.3 ΩһÐÔÔ¼Êø
ΩһÐÔÔ¼ÊøÖ¸¶¨Ò»¸ö»ò¶à¸öÁеÄ×éºÏµÄÖµ¾ßÓÐΩһÐÔ£¬ÒÔ·ÀÖ¹ÔÚÁÐÖÐÊäÈëÖظ´µÄÖµ¡£Î©Ò»ÐÔÔ¼ÊøÖ¸¶¨µÄÁпÉÒÔÓÐNULL ÊôÐÔ¡£ÓÉÓÚÖ÷¹Ø¼ü×ÖÖµÊǾßÓÐΩһÐԵģ¬Òò´ËÖ÷¹Ø¼ü×ÖÁв»ÄÜÔÙÉ趨ΩһÐÔÔ¼Êø¡£Î©Ò»ÐÔÔ¼Êø×î¶àÓÉ16 ¸öÁÐ×é³É¡£
¶¨ÒåΩһÐÔÔ¼ÊøµÄÓï·¨ÈçÏ£º
CONSTRAINT constraint_name
UNIQUE [CLUSTERED | NONCLUSTERED]
£¨column_name1[, column_name2,¡,column_name16]£©Àý7-5£º¶¨ÒåÒ»¸öÔ±¹¤ÐÅÏ¢±í£¬ÆäÖÐÔ±¹¤µÄÉí·ÝÖ¤ºÅ¾ßÓÐΩһÐÔ¡£
create table employees (
emp_id char(8),
emp_name char(10) ,
emp_cardid char(18),
constraint pk_emp_id primary key (emp_id),
constraint uk_emp_cardid unique (emp_cardid)
) on [primary]7.2.4 ¼ì²éÔ¼Êø
¼ì²éÔ¼Êø¶ÔÊäÈëÁлòÕû¸ö±íÖеÄÖµÉèÖüì²éÌõ¼þ£¬ÒÔÏÞÖÆÊäÈëÖµ£¬±£Ö¤Êý¾Ý¿âµÄÊý¾ÝÍêÕûÐÔ¡£¿ÉÒÔ¶Ôÿ¸öÁÐÉèÖ÷ûºÏ¼ì²é¡£
¶¨Òå¼ì²éÔ¼ÊøµÄÓï·¨ÈçÏ£º
CONSTRAINT constraint_name
CHECK [NOT FOR REPLICATION]
(logical_expression)
¸÷²ÎÊý˵Ã÷ÈçÏÂ:
NOT FOR REPLICATION
Ö¸¶¨¼ì²éÔ¼ÊøÔÚ°Ñ´ÓÆäËü±íÖи´ÖƵÄÊý¾Ý²åÈëµ½±íÖÐʱ²»·¢Éú×÷Óá£
logical_expression
Ö¸¶¨Âß¼Ìõ¼þ±í´ïʽ·µ»ØֵΪTRUE »òFALSE¡£
Àý7-6£º ´´½¨Ò»¸ö¶©»õ±íÆäÖж¨»õÁ¿±ØÐ벻СÓÚ10¡£
create table orders(
order_id char(8),
p_id char(8),
p_name char(10) ,
quantity smallint,
constraint pk_order_id primary key (order_id),
constraint chk_quantity check (quantity>=10) ,
) on [primary]
×¢Ò⣺¶Ô¼ÆËãÁв»ÄÜ×÷³ý¼ì²éÔ¼ÊøÍâµÄÈκÎÔ¼Êø¡£7.2.5 ȱʡԼÊø
ȱʡԼÊøͨ¹ý¶¨ÒåÁеÄȱʡֵ»òʹÓÃÊý¾Ý¿âµÄȱʡֵ¶ÔÏó°ó¶¨±íµÄÁУ¬À´Ö¸¶¨ÁеÄȱʡֵ¡£SQL Server ÍƼöʹÓÃȱʡԼÊø£¬¶ø²»Ê¹Óö¨ÒåȱʡֵµÄ·½Ê½À´Ö¸¶¨ÁеÄȱʡֵ¡£Óйذó¶¨È±Ê¡Ô¼ÊøµÄ·½·¨Çë²Î¼û¡°Êý¾ÝÍêÕûÐÔ¡±Õ½ڡ£
¶¨ÒåȱʡԼÊøµÄÓï·¨ÈçÏ£º
CONSTRAINT constraint_name
DEFAULT constant_expression [FOR column_name]
Àý7-7£º
constraint de_order_quantity default 100 for order_quantity
×¢Ò⣺²»ÄÜÔÚ´´½¨±íʱ¶¨ÒåȱʡԼÊø£¬Ö»ÄÜÏòÒѾ´´½¨ºÃµÄ±íÖÐÌí¼ÓȱʡԼÊø¡£
7.2.6 ÁÐÔ¼ÊøºÍ±íÔ¼Êø
¶ÔÓÚÊý¾Ý¿âÀ´Ëµ£¬Ô¼ÊøÓÖ·ÖΪÁÐÔ¼Êø£¨Column Constraint£©ºÍ±íÔ¼Êø£¨Table Constraint£©¡£
ÁÐÔ¼Êø×÷ΪÁж¨ÒåµÄÒ»²¿·ÖÖ»×÷ÓÃÓÚ´ËÁб¾Éí¡£±íÔ¼Êø×÷Ϊ±í¶¨ÒåµÄÒ»²¿·Ö£¬¿ÉÒÔ×÷ÓÃÓÚ
¶à¸öÁС£
ÏÂÃæ¾ÙÀý˵Ã÷ÁÐÔ¼ÊøÓë±íÔ¼ÊøµÄÇø±ð¡£
Àý7-8£º
create table products (
p_id char(8) ,
p_name char(10) ,
price money default 0.01 ,
quantity smallint check (quantity>=10) , /* ÁÐÔ¼Êø */
constraint pk_p_id primary key (p_id, p_name) /* ±íÔ¼Êø */ -
²»ÒªÅ«Á¥°ãµÄ¹¤×÷£¨Ä«·Æ£©×ª
2009-04-12 21:32:15
ÒªÏñÅ«Á¥°ãµØÈ¥¹¤×÷£»²»ÒªÏàÐÅÖ»Óк¹Ë®ºÍ¼è¿à·Ü¶·²ÅÄܱäΪ¸»ÓУ¬ÊÂʵ²¢²»ÊÇÕâÑù£¬Éú»îµÃÔ½ÇáËÉÔ½ºÃ¡£×öÄã°®¸ÉµÄÊ£¬È¥¸ÐÊÜËüµÄÀÖȤºÍ¼¤¶¯¡£¶Ô×Ô¼ºËµ¡°ÎÒ½«¸»ÓС±°É£¬ÆäʵÄã²»ÊÇÔÚ˵¡°¸»ÓС±£¬¶øÊÇÔÚ˼Ë÷ÄÚÔÚµÄÕæÕý¶¯Á¦¡£µ«Ò²²»ÒªÒÔΪÖظ´µØ˵¾ÍÄܸ»ÓУ¬È˵ÄDZÒâʶֻ½ÓÊÜ¡°µ±Õ桱µÄ¶«Î÷ºÍ¼á¶¨µÄÐÅÄ¶ø²»ÊÇ¿Õ¶´µÄ´Ê¾ä¡£Ò²ÐíÄú²»ÈÏͬDZÒâʶ£¬µ«ÏàÐÅԼɪ·ò¡¤Ä«·ÆµÄÑݽ²ÒÀÈ»»áʹÄãÊÜÒæ¡£-psytopic.comÈç¹ûÄã¾¼ÃÉÏÓÐÀ§ÄÑ£¬¾³£µ£ÐÄÊÕÖ§ÊÇ·ñÄÜÏàµÖ£¬Õâ¾ÍÒâζ×ÅÄ㻹ûÓÐÈÃÄãµÄDZÒâʶÐÅ·þ£¬¼´£¬Äã×ÜÊǸ»×ãÓÐÓàµÄ¡£ÄãÖªµÀ£¬ÓÐЩÈËÒ»Öܹ¤×÷¼¸Ð¡Ê±£¬µ«ÕõµÄǮȴÏ൱¾ªÈË¡£
²»ÒªÏñÅ«Á¥°ãµØÈ¥¹¤×÷£»²»ÒªÏàÐÅÖ»Óк¹Ë®ºÍ¼è¿à·Ü¶·²ÅÄܱäΪ¸»ÓУ¬ÊÂʵ²¢²»ÊÇÕâÑù£¬Éú»îµÃÔ½ÇáËÉÔ½ºÃ¡£×öÄã°®¸ÉµÄÊ£¬È¥¸ÐÊÜËüµÄÀÖȤºÍ¼¤¶¯¡£
ÎÒÈÏʶһλÂåÉ¼í¶µÄÆóÒµÁìµ¼ÈË£¬ÔÂÊÕÈë7500ÃÀÔª¡£È¥ÄêËûÐݼÙ9¸öÔ£¬×ö»·ÇòÂÃÐУ¬µ½È«ÊÀ½çÖøÃûµÄ³ÇÊÐÈ¥ÂÃÓι۹⡣Ëû¶ÔÎÒ˵£¬ËûÒѾ³É¹¦µØ˵·þËû×Ô¼º£¬ËûÖµÕâô¶àÇ®¡£
Ëû˵Ëû¹«Ë¾ÀïµÄһЩԱ¹¤£¬Ò»ÖÜÖ»ÓÐ100¶àÃÀÔª£¬¶ÔÒµÎñ±ÈËû¶®µÃ»¹¶à£¬Ò²ÐíÈÃËûÃǸÉ×ܾÀí±ÈËû¸ÉµÃ»¹ºÃ£¬Ö»ÊÇËûÃÇûÓÐÒ°ÐÄ£¬Ã»Óд´ÐµÄÏë·¨£¬¶ÔDZÒâʶµÄÆæ¼£²»¸ÐÐËȤ¡£
¸»ÓÐÊÇÒ»ÖÖÐÄÀí£¬ÊÇ×ÔÎÒµÄÒ»ÖÖÄÚÔÚÒâʶ¡£Äã²»»áÒòΪ˵£º¡°ÎÒÊÇ°ÙÍò¸»ÎÌ£¬ÎÒÊÇ°ÙÍò¸»ÎÌ¡±£¬¾Í»á³ÉΪ°ÙÍò¸»ÎÌ¡£µ«Äã»áͨ¹ý½¨Á¢¸»ÓеÄÏë·¨£¬Öð½¥ÓÐÁ˸»ÓеÄÒâʶ¡£
´ó¶àÊýÈ˶¼²»ÄÜÀûÓÃ×ÔÉíÄÚÔÚµÄÎÞÐÎÁ¦Á¿µÄÖ§³Ö¡£µ±ÉúÒâ²»¾°Æø£¬¹ÉÊÐϵø£¬Í¶×ÊÊÜËðʱ£¬ËûÃÇÍùÍù¸Ðµ½ºÜÎÞÄΡ£ÕâÖÖÎÞÒÀÎÞ¿¿µÄ¸Ð¾õÊÇÒòΪËûÃDz»ÖªµÀÔõÑùßµ¿ªÇ±ÒâʶµÄ´óÃÅ¡£ËûÃǶÔ×ÔÉíÄÚÔÚµÄÎÞ¾¡×ÊÔ´ºÁÎÞËùÖª¡£
Èç¹ûÄú¶ÔÕâƪÎÄÕ¸ÐÐËȤ£¬ÏàÐÅÄã»á¶ÔPSYTOPICͬÑù¸ÐÐËȤ£¬ÍøÖ·ÊÇPsytopic.com £¬Õâ´Îµã»÷²»»áÀË·ÑÄúµÄʱ¼ä¡£ÕâÊÇPsytopicµÄÖ¸ÎÆÃÜÂ룺aHR0cDovL3d3dy5wc3l0b3BpYy5jb20v£¬Äú¿ÉÒÔƾÕâ¸öÖ¸ÎÆÔÚgoogleËÑË÷µ½ÎÒÃǵÄÍøÕ¾¡£Ò»¸öÈ϶¨×Ô¼ºÆ¶ÇîµÄÈË×ÜÊÇ´¦ÓÚƶÀ§Ö®ÖС£ÁíÒ»¸öÈËÐÄÖг£Ë¼ÄÓУ¬×ÜÊÇʲô¶¼²»È±¡£¹ýƶÀ§µÄÈÕ×Ó¾ø·ÇÊÇÉϵ۵ÄÖ¼Òâ¡£Äã¿ÉÒԺܸ»ÓУ¬Ê²Ã´¶¼²»È±¡£
Äã·¢×ÔÄÚÐĵĻ°Óï¾ÍÊÇÁ¦Á¿£¬¾ÍÄÜÇå³ýÐÄÖеĴíÎóÏë·¨¡£Ò²ÐíÄã»á°ÑÄãËùÏëµØ˵³öÀ´£º¡°ÎÒÒª³ÉΪÓÐÇ®µÄÈË£¬ÎÒÒª³É¹¦¡£¡±ÄÇôÄã¾ÍÒ»ÌìÈýËĴεØÖظ´Ëµ°É¡£ÄãµÄ»°ÓïµÄÁ¦Á¿ÊǾ޴óµÄ£¬Ëü´ú±íÁËÄãDZÒâʶµÄÄÚÔÚÁ¦Á¿¡£
½«ÄãµÄÏë·¨ºÍDZÒâʶµÄÁ¦Á¿½áºÏÔÚÒ»Æð°É!ÔÚÄãµÄÉú»îÖУ¬Ìõ¼þºÍ»·¾³¶¼»áËæÄãµÄDZÒâʶ±ä»¯¶ø±ä»¯¡£
ÆäʵÄã²»ÊÇÔÚ˵¡°¸»ÓС±£¬ÄãÊÇÔÚ˼Ë÷ÄÚÔÚµÄÕæÕý¶¯Á¦¡£µ±Äã˵Ҫ¸»ÓÐʱ£¬ÄãµÄÒâʶÊܵ½ÁËDZÒâʶµÄÇ¿´óÖ§³Ö¡£
´ËÍ⣬µ±Äã˼¿¼¸»ÓÐʱ£¬ÄãÄÚÔھͳäÂúÁ˸»ÓеĸÐÊÜ¡£¸»ÓеĸÐÊܾͻá²úÉú¸»ÓС£Ê¼ÖÕ±£³ÖÕâÖÖÐÄ̬¡£ÄãµÄDZÒâʶÏñ¸öÒøÐУ¬²»¹ÜÄã´æ´¢Ê²Ã´£¬¶¼»á³É±¶µØ»Ø±¨Äã¡£ËùÒÔ£¬Ñ¡Ôñ¸»ÓаÉ!
Äã±ØÐëÉîÐŲƸ»ÊôÓÚÄ㣬µ±È»²¢²»ÊÇÄã˵×Ô¼º¸»ÓоͻḻÓеġ£ÔÚ¹ýÈ¥µÄ35ÄêÖУ¬ÎÒ³£Ìýµ½µÄÒ»°ã±§Ô¹ÊÇ£º¡°¼¸¸öÔÂÀ´£¬ÎÒÒ»Ö±ÔÚ˵ÎÒÒª¸»ÓУ¬ÎÒÒª·¢¼££¬¿ÉʲôҲû·¢Éú¡£¡±ÎÒ·¢ÏÖ£¬ËµÕâЩ»°µÄÈË£¬ËûÃǵÄÒâʶ×Ô¼º¾Í²»ÏàÐÅÕâ»áÊÇÕæµÄ¡£
ÓÐÈË˵Ëû²»¶ÏµØÔÚ˵¡°ÎÒÒª¸»ÓС±£¬Ò»Ö±µ½Ëû˵ÀÛÁËΪֹ£¬¿ÉÇé¿öÔ½À´Ô½Ôã¡£µ«Ëû×Ô¼ºÖªµÀ£¬Ëû˵ÕâЩ»°Ê±£¬ËûµÄÒâʶÖÐÓÐÁíÒ»¸öÉùÒô¡£
µ±ËûÒâʶÖдæÔÚ³åÍ»µÄʱºò£¬ËûµÄDZÒâʶȴ½ÓÊÜÁËÏà·´µÄ¶«Î÷¡£Ö»Óе±¾«ÉñÉÏûÓгåÍ»²úÉú£¬Ëù¿Ï¶¨µÄ¶«Î÷Óַdz£Ã÷ȷʱ£¬ÕâÖֿ϶¨²ÅÆð×÷Óá£Ç±Òâʶֻ½ÓÊÜ¡°µ±Õ桱µÄ¶«Î÷ºÍ¼á¶¨µÄÐÅÄ¶ø²»ÊÇ¿Õ¶´µÄ´Ê¾ä¡£
¶ÔÄÇЩ³£²úÉú˼Ïë³åÍ»µÄÈË£¬¿É°´ÕâÖÖ·½·¨À´ÊÔһϣº¾³£ÕâÑù˵£¬ÌرðÊÇÔÚÁÙ˯¾õÇ°£¬¡°ÎÒËù´ÓʵÄËùÓиÐÐËȤµÄÊÂÿʱÿ¿Ì£¬ÈÕÈÕÒ¹Ò¹¶¼¸øÎÒ´øÀ´Ï²Ôᣡ±ÕâÖÖ³ÂÊö²»»áÔÚÐÄÀïÒýÆðÕùÂÛ£¬ÓëÔÏÈDZÒâʶÖпÉÄÜ´æÔÚµÄȱǮµÄ¸ÐÊÜÒ²²»»á³åÍ»¡£
ÓиöÉÌÈËÔøÒ»¶ÈÏúÊÛ²»¾°Æø£¬ËûºÜµ£ÓÇ¡£ÎÒ½¨ÒéËûÔڰ칫ÊÒ×øÏÂÀ´£¬ÈÃÐÄÇéƽ¾²ÏÂÀ´£¬²»¶ÏµØÖظ´Ëµ£¬¡°ÎÒµÄÏúÊÛ×´¿ö¿ªÊ¼ÈÕÇ÷¸ÄÉÆÁË¡£¡±µ±ËûµÄÒâʶºÍDZÒâʶÄÜÏ໥ºÏ×÷ʱ£¬ÏÖʵÖоͻá²úÉú½á¹û¡£
²»ÒªÇ©¿Õ°×֧Ʊ¡£µ±ÄãÔÚ˵¡°Ê²Ã´¶¼ÓùâÁË¡±£¬¡°×ÜÊDz»¹»¡±£¬¡°µÖѺ³öÎÊÌâÁË¡±£¬¡°·¿×ÓÍêÁË¡±µÈµÈ£¬Äã¾ÍµÈÓÚÔÚÇ©¿Õ°×֧Ʊ¡£Èç¹ûÄã¶ÔδÀ´³äÂú¿Ö¾å£¬Ò²µÈÓÚÔÚÇ©¿Õ°×֧Ʊ£¬ÔÚ°ÑÏû¼«µÄÐÅÏ¢´ø¸ø×Ô¼º¡£
ÄãµÄDZÒâʶ½ÓÊÜÄãµÄ¿Ö¾åºÍÏû¼«µÄ³ÂÊö£¬È»ºó°´ÕÕËü×ÔÉí¹æÂÉ£¬ÎªÄã´øÀ´×è°¡¢ÍÏÑÓ¡¢ØÑ·¦ºÍÔ¼Êø¡£ÄÇЩ¸Ð¾õ¸»ÓеÄÈË£¬²Æ¸»¾Í»áÀ´µ½ËûÉíÅÔ£»ÄÇЩ¸Ð¾õƶÀ§µÄÈË£¬Æ¶À§¾Í°éËæ×ÅËû¡£ÄãµÄDZÒâʶ½«Äã¶ÔËüµÄ¡°´æ´¢¡±³É±¶·Å´ó¡£
ÿÌìÔ糿ÐÑÀ´ºó£¬½«½¡¿µ¡¢³É¹¦¡¢Æ½°²µÄ˼Ïë´æ´¢¸øËü£¬¾³£Ë¼Ë÷ÕâЩ¸ÅÄÐÄÀï³äÂúÕâЩÏë·¨£»ÕâЩÃÀºÃµÄÏë·¨»áÔÚÄãµÄDZÒâʶÖÐÕÒµ½¡°´æ´¢¡±Î»Öã¬Ö®ºó¾Í»áΪÄãÔÚÏÖʵÖдøÀ´¸»Óкͳɹ¦¡£
ÎÒ»áÌýµ½Äã˵£º¡°ÎÒÒ²ÄÇÑù×öÁË£¬¿Éʲô¶¼Ã»·¢Éú¡£¡±ÄãûÓнá¹ûÊÇÒòΪÄãÔÚ10·ÖÖÓÖ®ºóÓֻص½ÁËÔÏȵÄÏû¼«µÄÒâʶ״̬ÖУ¬ÄãµÄÃÀºÃÏë·¨¶ÔDZÒâʶµÄÓ°ÏìµÈÓÚÁã¡£µ±Ò»Á£ÖÖ×ÓÖÖÔÚµØÀÈç²»ÍÚµôµÄ»°£¬¾Í»áÉú¸ù¡¢³É³¤¡£
¼ÙÈçÄã˵£º¡°ÎÒÂò²»ÆðÕⶫÎ÷¡£¡±ÄãÓ¦¸ÃÔÚ¡°ÎÒÂò²»Æ𡱵ĵط½Í£ÏÂÀ´£¬È»ºóÏëÒ»Ï룬»»Ò»ÖÖ»ý¼«µÄ˼ά·½Ê½Ëµ£º¡°ÎÒ×ÜÓа취¡£¡±
ÄãµÄDZÒâʶ¾ö²»»áȱÉÙÏë·¨£¬ËüÓÐ×ÅÎÞÏÞµÄÖǻۣ¬Ê±Ê±¿Ì¿Ì¶¼×¼±¸ÔÚÄãÒâʶÖгöÏÖ£»»áÒÔ¸÷ÖÖ·½Ê½ÎªÄãµÄ¡°Æ¤¼ÐÀï¼ÓÇ®¡±¡£²»¹Ü¹ÉÊÐÊÇÕÇ»¹Êǵø£¬²»¹ÜÃÀÔªÔöÖµ»¹ÊDZáÖµ£¬ÔÚÄãÐÄÀïµÄÕâÒ»¹ý³Ì×ÜÊÇÈç´Ë£¬ÄãµÄ²Æ¸»´ÓÕæÕýÒâÒåÉϽ²£¬²»È¡¾öÓÚծȯ¡¢¹ÉƱ»òÒøÐÐÀïµÄÇ®£¬ËüÃÇÖ»ÊÇÏóÕ÷µÄ·ûºÅ¶øÒÑ¡£
Èç¹ûÄãÄÜʹÄãµÄDZÒâʶÉîÐŲƸ»ÊÇÊôÓÚÄãµÄ£¬ÄãÒ»ÉúÖÐ×ܻḻ×ãÓÐÓàµÄ¡£Äã±Ø½«¸»ÓУ¬²»¹Ü²Æ¸»ÊÇÒÔºÎÖÖ·½Ê½´æÔÚ¡£
-
ËÀËø
2009-03-15 20:14:03
Ò» ËÀËø²úÉúµÄÌõ¼þ
·¢ÉúËÀËøµÄ±ØÒªÌõ¼þÓÐÒÔÏÂËĸö
»¥³âÌõ¼þ£ºÒ»¸öÊý¾Ý¶ÔÏóÒ»´ÎÖ»Äܱ»Ò»¸öÊÂÎïʹÓ㬼´¶ÔÊý¾Ý¿âµÄ·âËø²ÉÓÃÅÅ
²»¿ÉÇÀÕ¼Ìõ¼þ£ºÒ»¸öÊý¾Ý¶ÔÏóÖ»Äܱ»Õ¼ÓÃËûµÄÊÂÎïÊÍ·Å
²¿·Ö·ÖÅäÌõ¼þ£ºÒ»¸öÊÂÎñÒѾ·âËø·Ö¸øËûµÄÊý¾Ý¶ÔÏ󣬵«ÈÔȻҪÇó·âËøÆäËûÊý¾Ý
Ñ»·µÈ´ýÌõ¼þ£ºÔÊÐíµÈ´ýÆäËûÊÂÎïÊͷŵÄÊý¾Ý¶ÔÏó£¬ÏµÍ³´¦ÓÚ¼ÓËøÇëÇóÏ໥µÈ´ýµÄ״̬¡£
¶þ ËÀËøµÄÔ¤·À
Ò»´Î¼ÓËø·¨£º
˳Ðò¼ÓËø·¨
Èý ËÀËøÕï¶ÏÓë½â³ý
¿ÉÒÔÀûÓõÄÊÂÎñµÄÐÅÀµÍ¼µÄÐÎʽ²âÊÔϵͳÖÐÊÇ·ñ´æÔÚËÀËø¡£
Èç¹ûÒѾ·¢ÏÖËÀËø£¬dba´ÓÒÀÀµÏàͬµÄÊÂÎñ³é³öij¸öÊÂÎñ×÷ΪÎþÉüÆ·£¬½«Ëû³·Ïú£¬½â³ýËüËùÓеķâËø£¬ÊÍ·Å´ËÊÂÎñ³¤ÓÐËùÓеÄÊý¾Ý×ÊÔ´£¬·ÖÅä¸øÆäËûÊÂÎñ£¬Ê¹ÆäËûÊÂÎñµÃÒÔ¼ÌÐøÔËÐÐÏÂÈ¥£¬ÔÚ½â³ýËÀËøµÄ¹ý³ÌÖУ¬³éÈ¡ÎþÉüÊÂÎñµÄ±ê×¼ÊǸù¾Ýϵͳ״̬¼°ÆäÓ¦ÓõÄʵ¼ÊÇé¿öÀ´È·¶¨£¬Í¨³£²ÉÓõķ½·¨Ö®Ò»ÊÇÑ¡ÔñÒ»¸ö´¦ÀíËÀËø´ú¼Û×îСµÄÊÂÎñ£¬½«Æä³·Ïú¡£²»ÖØÒªµÄÓû§£¬È¡ÏûÆä²Ù×÷£¬ÊÍ·Å·âËøÊý¾Ý£¬»Ö¸´Êý¾Ý¿âËùÓеĸı䡣
-
×óÁ¬½Ó£¬ÓÐÁ´½Ó
2009-03-15 20:11:09
left join :×óÁ¬½Ó£¬·µ»Ø×ó±íÖÐËùÓеļǼÒÔ¼°ÓÒ±íÖÐÁ¬½Ó×Ö¶ÎÏàµÈµÄ¼Ç¼¡£
right join :ÓÒÁ¬½Ó£¬·µ»ØÓÒ±íÖÐËùÓеļǼÒÔ¼°×ó±íÖÐÁ¬½Ó×Ö¶ÎÏàµÈµÄ¼Ç¼¡£
inner join: ÄÚÁ¬½Ó£¬ÓֽеÈÖµÁ¬½Ó£¬Ö»·µ»ØÁ½¸ö±íÖÐÁ¬½Ó×Ö¶ÎÏàµÈµÄÐС£
full join:ÍâÁ¬½Ó£¬·µ»ØÁ½¸ö±íÖеÄÐУºleft join + right join
cross join:½á¹ûÊǵѿ¨¶û»ý£¬¾ÍÊǵÚÒ»¸ö±íµÄÐÐÊý³ËÒÔµÚ¶þ¸ö±íµÄÐÐÊý¡£
²¹³ä˵Ã÷£ºÈç¹û±íÒ»ÖеÄijÐжÔÓ¦±í¶þÖеÄÁ½ÐмǼ£¬ÄÇô½á¹û¼¯ÖлáÓÐÁ½Ìõ¼Ç¼¶ÔÓ¦£¬right joinҲͬÑùµÀÀí¡£
----------------------------------------------------------------------------------------------------Àý×Ó
declare @a table(a int,b int)
declare @b table(a int,b int)insert @a values(1,1)
insert @a values(2,2)
insert @b values(1,1)
insert @b values(3,3)
select * from @a
select * from @b
--×ó:
select * from @a Aa left join @b Bb on Aa.a=Bb.a
--ÓÒ£º
select * from @a Aa right join @b Bb on Aa.a=Bb.a
--ÄÚ
select * from @a Aa inner join @b Bb on Aa.a=Bb.a
--Í⣺
select * from @a Aa full join @b Bb on Aa.a=Bb.a
--½»²æÁ¬½Ó
select * from @a cross join @b
-
LoadRunner CPC Exam
2009-02-22 21:55:47
I flew up to Sydney yesterday for the privilege of being (as far as I know) the first non-Mercury employee to sit for the LoadRunner CPC exam in Australia.
Feedback from people who had already taken the exam seemed to be almost universally along the lines of ¡°there is a lot to get through. Know the subject thoroughly. You will not have time to look up documentation.¡± Mercury representatives said, ¡°If you could do your LoadRunner CPS exam, then you should have no problems with the CPC.¡±
I had previously completed my LoadRunner CPS and had been using LoadRunner for a long time but, even so, I found the exam extremely challenging and used every minute of the allocated time.
The LoadRunner 7.6 CPC exam is to be completed in 1 day (8 hours). The pass mark is 70%, and a total of 134 possible points are allocated to the four exam sections as follows:
Section A - Scripting exercises.
60 points (45%)
3 hours.Section B - LoadRunner Controller + Multiple choice questions.
28 points (21%)
2 hours 30 minutes.Section C - Multiple choice questions.
36 points (27%)
15 minutes.Section D - C programming.
10 points (7%)
30 minutes.As can be seen from the recommended completion times for each section, Mercury’s estimates are definitely on the low side (adding up to only 6 hours, 15 minutes), and the possible scores for each section do not correlate with the suggested times.
I spent 4 hours and 30 minutes on Section A, and 45 minutes on Section D, with the rest of the time split between the two remaining sections.
The questions in Section A build on each other. If you cannot complete the first question, you will not be able to go on with subsequent questions. Having completed the exercises from the CPS comes in handy here, as some of the questions are similar. Ensure that you are familiar with parameterisation and correlation using both recording modes (as far as I can remember, the CPS only used URL mode). Try not to make assumptions about what is required. Follow the instructions to the letter. If you miss something on an earlier question, you will probably not have time to go back, make changes to all your previous scripts and re-run them. Remember that script. execution for debugging purposes can be sped up by turning off “Animated Run†and closing the output window. Your script. execution will be CPU-bound, and these items have a large overhead.
Section B focuses on creating and executing a scenario. There are no surprises here, but one of the key questions is based on how Mercury thinks a load test should be run, so your own experiences/prejudices may have little value. There is at least 30 minutes of execution time in this section that can be completed in parallel with Section C or D. Just remember that, as the Application Under Test will probably be running on the same machine as the controller, any compilations or searches through Acrobat files will affect the scenario results as they push CPU utilisation to 100%.
Section C is an opportunity to pick up some easy marks. There are 36 possible points for the 32 multiple-choice questions. There are some obscure questions here that you are guaranteed to have never encountered, but all answers can be found by searching through the documentation or experimenting with LoadRunner. As with the CPC, there are some very ambiguous questions, and even a question on the features of a type of graph that unintentionally leaves the name of the graph out of the question. When in doubt, deal with ambiguity by documenting your assumptions about what the question means.
Section D is the easiest section for guaranteed marks. You are given a script. that contains compilation, logical and functional errors and must make it run against the Application Under Test. if you have a working knowledge of C, it shouldn¡¯t be hard to track down the compilation errors. Start with the first error and work down the list. Remember that a “not writing pre_cci.ci†output message from the compiler can (non-obviously) push the real error off the top of the debug window. Once the compiler errors are taken care of, you must ensure that the script. meets its stated aim. This will not be hard if you can successfully complete Section A.
Apparently the LoadRunner 7.6 CPC exam has a very high failure rate. I am not totally confident of receiving a passing grade myself. All questions were answered and all exercises were completed to the specifications, but my scripts were short on elegant solutions and clearly written code. My fingers are crossed for some generous marking.
Update: I finally received my results, and I passed this exam comfortably.
-
Êý¾Ý¿âÖеĸ߼¶²éѯ2
2009-02-19 22:35:03
1.UNION,EXCEPT,INTERSECTÔËËã·û
A,UNION ÔËËã·û
UNION ÔËËã·ûͨ¹ý×éºÏÆäËûÁ½¸ö½á¹û±í£¨ÀýÈç TABLE1 ºÍ TABLE2£©²¢ÏûÈ¥±íÖÐÈκÎÖظ´ÐжøÅÉÉú³öÒ»¸ö½á¹û±í¡£
µ± ALL Ëæ UNION Ò»ÆðʹÓÃʱ£¨¼´ UNION ALL£©£¬²»Ïû³ýÖظ´ÐС£Á½ÖÖÇé¿öÏ£¬ÅÉÉú±íµÄÿһÐв»ÊÇÀ´×Ô TABLE1 ¾ÍÊÇÀ´×Ô TABLE2¡£
B, EXCEPT ÔËËã·û
EXCEPT ÔËËã·ûͨ¹ý°üÀ¨ËùÓÐÔÚ TABLE1 Öе«²»ÔÚ TABLE2 ÖеÄÐв¢Ïû³ýËùÓÐÖظ´ÐжøÅÉÉú³öÒ»¸ö½á¹û±í¡£
µ± ALL Ëæ EXCEPT Ò»ÆðʹÓÃʱ (EXCEPT ALL)£¬²»Ïû³ýÖظ´ÐС£
C,INTERSECT ÔËËã·û
INTERSECT ÔËËã·ûͨ¹ýÖ»°üÀ¨ TABLE1 ºÍ TABLE2 Öж¼ÓеÄÐв¢Ïû³ýËùÓÐÖظ´ÐжøÅÉÉú³öÒ»¸ö½á¹û±í¡£
µ± ALL Ëæ INTERSECT Ò»ÆðʹÓÃʱ (INTERSECT ALL)£¬²»Ïû³ýÖظ´ÐС£
×¢£ºÊ¹ÓÃÔËËã´ÊµÄ¼¸¸ö²éѯ½á¹ûÐбØÐëÊÇÒ»Öµġ£
----------------------------------------------------------------------------------------------------
2.ÍâÁ¬½Ó
A¡¢left outer join£º
×óÍâÁ¬½Ó£¨×óÁ¬½Ó£©£º½á¹û¼¯¼¸°üÀ¨Á¬½Ó±íµÄÆ¥ÅäÐУ¬Ò²°üÀ¨×óÁ¬½Ó±íµÄËùÓÐÐС£
sql: select a.a, a.b, a.c, b.c, b.d, b.f from a LEFT OUT JOIN b ON a.a = b.c
B£ºright outer join:
ÓÒÍâÁ¬½Ó(ÓÒÁ¬½Ó)£º½á¹û¼¯¼È°üÀ¨Á¬½Ó±íµÄÆ¥ÅäÁ¬½ÓÐУ¬Ò²°üÀ¨ÓÒÁ¬½Ó±íµÄËùÓÐÐС£
C£ºfull outer join£º
È«ÍâÁ¬½Ó£º²»½ö°üÀ¨·ûºÅÁ¬½Ó±íµÄÆ¥ÅäÐУ¬»¹°üÀ¨Á½¸öÁ¬½Ó±íÖеÄËùÓмǼ¡£
----------------------------------------------------------------------------------------------------
Æä´Î£¬´ó¼ÒÀ´¿´Ò»Ð©²»´íµÄsqlÓï¾ä
1¡¢ËµÃ÷£º¸´ÖƱí(Ö»¸´Öƽṹ,Ô´±íÃû£ºa бíÃû£ºb) (Access¿ÉÓÃ)
·¨Ò»£ºselect * into b from a where 1<>1
·¨¶þ£ºselect top 0 * into b from a
2¡¢ËµÃ÷£º¿½±´±í(¿½±´Êý¾Ý,Ô´±íÃû£ºa Ä¿±ê±íÃû£ºb) (Access¿ÉÓÃ)
insert into b(a, b, c) select d,e,f from b;
3¡¢ËµÃ÷£º
¿çÊý¾Ý¿âÖ®¼ä±íµÄ¿½±´(¾ßÌåÊý¾ÝʹÓþø¶Ô·¾¶) (Access¿ÉÓÃ)
insert into b(a, b, c) select d,e,f from b in ¡®¾ßÌåÊý¾Ý¿â¡¯ where Ìõ¼þ
Àý×Ó£º..from b in '"&Server.MapPath(".")&"\data.mdb" &"' where..
4¡¢ËµÃ÷£º×Ó²éѯ(±íÃû1£ºa ±íÃû2£ºb)
select a,b,c from a where a IN (select d from b )
»òÕß: select a,b,c from a where a IN (1,2,3)
5¡¢ËµÃ÷£ºÏÔʾÎÄÕ¡¢Ìá½»È˺Í×îºó»Ø¸´Ê±¼ä
select a.title,a.username,b.adddate from table a,(select max(adddate) adddate from table where table.title=a.title) b
6¡¢ËµÃ÷£ºÍâÁ¬½Ó²éѯ(±íÃû1£ºa ±íÃû2£ºb)
select a.a, a.b, a.c, b.c, b.d, b.f from a LEFT OUT JOIN b ON a.a = b.c
7¡¢ËµÃ÷£ºÔÚÏßÊÓͼ²éѯ(±íÃû1£ºa )
select * from (SELECT a,b,c FROM a) T where t.a > 1;
8¡¢ËµÃ÷£ºbetweenµÄÓ÷¨,betweenÏÞÖƲéѯÊý¾Ý·¶Î§Ê±°üÀ¨Á˱߽çÖµ,not between²»°üÀ¨
select * from table1 where time between time1 and time2
select a,b,c, from table1 where a not between ÊýÖµ1 and ÊýÖµ2
9¡¢ËµÃ÷£ºin µÄʹÓ÷½·¨
select * from table1 where a [not] in (¡®Öµ1¡¯,¡¯Öµ2¡¯,¡¯Öµ4¡¯,¡¯Öµ6¡¯)
10¡¢ËµÃ÷£ºÁ½ÕŹØÁª±í£¬É¾³ýÖ÷±íÖÐÒѾÔÚ¸±±íÖÐûÓеÄÐÅÏ¢
delete from table1 where not exists ( select * from table2 where table1.field1=table2.field1 )
11¡¢ËµÃ÷£ºËıíÁª²éÎÊÌ⣺
select * from a left inner join b on a.a=b.b right inner join c on a.a=c.c inner join d on a.a=d.d where .....
12¡¢ËµÃ÷£ºÈճ̰²ÅÅÌáÇ°Îå·ÖÖÓÌáÐÑ
sql: select * from Èճ̰²ÅÅ where datediff('minute',f¿ªÊ¼Ê±¼ä,getdate())>5
13¡¢ËµÃ÷£ºÒ»Ìõsql Óï¾ä¸ã¶¨Êý¾Ý¿â·ÖÒ³
select top 10 b.* from (select top 20 Ö÷¼ü×Ö¶Î,ÅÅÐò×ֶΠfrom ±íÃû order by ÅÅÐò×ֶΠdesc) a,
±íÃû b where b.Ö÷¼ü×ֶΠ= a.Ö÷¼ü×ֶΠorder by a.ÅÅÐò×Ö¶Î
14¡¢ËµÃ÷£ºÇ°10Ìõ¼Ç¼
select top 10 * form. table1 where ·¶Î§
15¡¢ËµÃ÷£ºÑ¡ÔñÔÚÿһ×ébÖµÏàͬµÄÊý¾ÝÖжÔÓ¦µÄa×î´óµÄ¼Ç¼µÄËùÓÐÐÅÏ¢
(ÀàËÆÕâÑùµÄÓ÷¨¿ÉÒÔÓÃÓÚÂÛ̳ÿÔÂÅÅÐаñ,ÿÔÂÈÈÏú²úÆ··ÖÎö,°´¿ÆÄ¿³É¼¨ÅÅÃû,µÈµÈ.)
select a,b,c from tablename ta where a=(select max(a) from tablename tb where tb.b=ta.b)
16¡¢ËµÃ÷£º°üÀ¨ËùÓÐÔÚ TableA Öе«²»ÔÚ TableBºÍTableC ÖеÄÐв¢Ïû³ýËùÓÐÖظ´ÐжøÅÉÉú³öÒ»¸ö½á¹û±í
(select a from tableA ) except (select a from tableB) except (select a from tableC)
17¡¢ËµÃ÷£ºËæ»úÈ¡³ö10ÌõÊý¾Ý
select top 10 * from tablename order by newid()
18¡¢ËµÃ÷£ºËæ»úÑ¡Ôñ¼Ç¼
select newid()
19¡¢ËµÃ÷£ºÉ¾³ýÖظ´¼Ç¼
Delete from tablename where id not in (select max(id) from tablename group by col1,col2,...)
20¡¢ËµÃ÷£ºÁгöÊý¾Ý¿âÀïËùÓеıíÃû
select name from sysobjects where type='U'
21¡¢ËµÃ÷£ºÁгö±íÀïµÄËùÓеÄ
select name from syscolumns where id=object_id('TableName')
22¡¢ËµÃ÷£ºÁÐʾtype¡¢vender¡¢pcs×ֶΣ¬ÒÔtype×Ö¶ÎÅÅÁУ¬case¿ÉÒÔ·½±ãµØʵÏÖ¶àÖØÑ¡Ôñ£¬ÀàËÆselect ÖеÄcase¡£
select type,sum(case vender when 'A' then pcs else 0 end),
sum(case vender when 'C' then pcs else 0 end),
sum(case vender when 'B' then pcs else 0 end)
FROM tablename group by type
ÏÔʾ½á¹û£º
type vender pcs
µçÄÔ A 1
µçÄÔ A 1
¹âÅÌ B 2
¹âÅÌ A 2
ÊÖ»ú B 3
ÊÖ»ú C 3
23¡¢ËµÃ÷£º³õʼ»¯±ítable1
TRUNCATE TABLE table1
24¡¢ËµÃ÷£ºÑ¡Ôñ´Ó10µ½15µÄ¼Ç¼
select top 5 * from (select top 15 * from table order by id asc) table_±ðÃû order by id desc
Ëæ»úÑ¡ÔñÊý¾Ý¿â¼Ç¼µÄ·½·¨£¨Ê¹ÓÃRandomizeº¯Êý£¬Í¨¹ýSQLÓï¾äʵÏÖ£©
¶Ô´æ´¢ÔÚÊý¾Ý¿âÖеÄÊý¾ÝÀ´Ëµ£¬Ëæ»úÊýÌØÐÔÄܸø³öÉÏÃæµÄЧ¹û£¬µ«ËüÃÇ¿ÉÄÜÌ«ÂýÁËЩ¡£
Äã²»ÄÜÒªÇóASP¡°ÕÒ¸öËæ»úÊý¡±È»ºó´òÓ¡³öÀ´¡£Êµ¼ÊÉϳ£¼ûµÄ½â¾ö·½°¸Êǽ¨Á¢ÈçÏÂËùʾµÄÑ»·£º
Randomize
RNumber = Int(Rnd*499) +1
While Not objRec.EOF
If objRec("ID") = RNumber THEN
... ÕâÀïÊÇÖ´Ðнű¾ ...
end if
objRec.MoveNext
Wend
ÕâºÜÈÝÒ×Àí½â¡£Ê×ÏÈ£¬ÄãÈ¡³ö1µ½500·¶Î§Ö®ÄÚµÄÒ»¸öËæ»úÊý£¨¼ÙÉè500¾ÍÊÇÊý¾Ý¿âÄڼǼµÄ×ÜÊý£©¡£
È»ºó£¬Äã±éÀúÿһ¼Ç¼À´²âÊÔID µÄÖµ¡¢¼ì²éÆäÊÇ·ñÆ¥ÅäRNumber¡£Âú×ãÌõ¼þµÄ»°¾ÍÖ´ÐÐÓÉTHEN ¹Ø¼ü×Ö¿ªÊ¼µÄÄÇÒ»¿é´úÂë¡£
¼ÙÈçÄãµÄRNumber µÈÓÚ495£¬ÄÇôҪѻ·Ò»±éÊý¾Ý¿â»¨µÄʱ¼ä¿É¾Í³¤ÁË¡£
ËäÈ»500Õâ¸öÊý×Ö¿´ÆðÀ´´óÁËЩ£¬µ«Ïà±È¸üΪÎȹ̵ÄÆóÒµ½â¾ö·½°¸Õ⻹ÊǸöСÐÍÊý¾Ý¿âÁË£¬ºóÕßͨ³£ÔÚÒ»¸öÊý¾Ý¿âÄھͰüº¬Á˳ÉǧÉÏÍòÌõ¼Ç¼¡£
Õâʱºò²»¾ÍËÀ¶¨ÁË£¿
²ÉÓÃSQL£¬Äã¾Í¿ÉÒԺܿìµØÕÒ³ö׼ȷµÄ¼Ç¼²¢ÇÒ´ò¿ªÒ»¸öÖ»°üº¬¸Ã¼Ç¼µÄrecordset£¬ÈçÏÂËùʾ£º
Randomize
RNumber = Int(Rnd*499) + 1
sql = "SELECT * FROM Customers WHERE ID = " & RNumber
set bjRec = ObjConn.Execute(SQL)
Response.WriteRNumber & " = " & objRec("ID") & " " & objRec("c_email")
²»±Øд³öRNumber ºÍID£¬ÄãÖ»ÐèÒª¼ì²éÆ¥ÅäÇé¿ö¼´¿É¡£
Ö»ÒªÄã¶ÔÒÔÉÏ´úÂëµÄ¹¤×÷ÂúÒ⣬Äã×Ô¿É°´Ðè²Ù×÷¡°Ëæ»ú¡±¼Ç¼¡£
RecordsetûÓаüº¬ÆäËûÄÚÈÝ£¬Òò´ËÄãºÜ¿ì¾ÍÄÜÕÒµ½ÄãÐèÒªµÄ¼Ç¼ÕâÑù¾Í´ó´ó½µµÍÁË´¦Àíʱ¼ä¡£
--------------------------------------------------------------------------------------
ÔÙ̸Ëæ»úÊý
ÏÖÔÚÄã϶¨¾öÐÄÒªÕ¥¸ÉRandom º¯ÊýµÄ×îºóÒ»µÎÓÍ£¬ÄÇôÄã¿ÉÄÜ»áÒ»´ÎÈ¡³ö¶àÌõËæ»ú¼Ç¼»òÕßÏë²ÉÓÃÒ»¶¨Ëæ»ú·¶Î§ÄڵļǼ¡£
°ÑÉÏÃæµÄ±ê×¼Random ʾÀýÀ©Õ¹Ò»Ï¾ͿÉÒÔÓÃSQLÓ¦¶ÔÉÏÃæÁ½ÖÖÇé¿öÁË¡£
ΪÁËÈ¡³ö¼¸ÌõËæ»úÑ¡ÔñµÄ¼Ç¼²¢´æ·ÅÔÚͬһrecordsetÄÚ£¬Äã¿ÉÒÔ´æ´¢Èý¸öËæ»úÊý£¬È»ºó²éѯÊý¾Ý¿â»ñµÃÆ¥ÅäÕâЩÊý×ֵļǼ£º
sql = "SELECT * FROM Customers WHERE ID = " & RNumber & " OR ID = " & RNumber2 & " OR ID = " & RNumber3
¼ÙÈçÄãÏëÑ¡³ö10Ìõ¼Ç¼£¨Ò²ÐíÊÇÿ´ÎÒ³Ãæ×°ÔØʱµÄ10ÌõÁ´½ÓµÄÁÐ±í£©£¬
Äã¿ÉÒÔÓÃBETWEEN »òÕßÊýѧµÈʽѡ³öµÚÒ»Ìõ¼Ç¼ºÍÊʵ±ÊýÁ¿µÄµÝÔö¼Ç¼¡£
ÕâÒ»²Ù×÷¿ÉÒÔͨ¹ýºÃ¼¸ÖÖ·½Ê½À´Íê³É£¬µ«ÊÇ SELECT Óï¾äÖ»ÏÔʾһÖÖ¿ÉÄÜ£¨ÕâÀïµÄID ÊÇ×Ô¶¯Éú³ÉµÄºÅÂ룩£º
sql = "SELECT * FROM Customers WHERE ID BETWEEN " & RNumber & " AND " & RNumber & "+ 9"
×¢Ò⣺ÒÔÉÏ´úÂëµÄÖ´ÐÐÄ¿µÄ²»ÊǼì²éÊý¾Ý¿âÄÚÊÇ·ñÓÐ9Ìõ²¢·¢¼Ç¼¡£
Ëæ»ú¶ÁÈ¡Èô¸ÉÌõ¼Ç¼£¬
²âÊÔ¹ý
AccessÓï·¨£ºSELECT top 10 * From ±íÃû ORDER BY Rnd(id)
sql server:select top n * from ±íÃû order by newid()
mysqlelect * From ±íÃû Order By rand() Limit n
Access×óÁ¬½ÓÓï·¨(×î½ü¿ª·¢ÒªÓÃ×óÁ¬½Ó,Access°ïÖúʲô¶¼Ã»ÓÐ,ÍøÉÏûÓÐAccessµÄSQL˵Ã÷,Ö»ÓÐ×Ô¼º²âÊÔ, ÏÖÔÚ¼ÇÏÂÒÔ±¸ºó²é)
Óï·¨elect table1.fd1,table1,fd2,table2.fd2 From table1 left join table2 on table1.fd1,table2.fd1 where ...
ʹÓÃSQLÓï¾ä ÓÃ...´úÌæ¹ý³¤µÄ×Ö·û´®ÏÔʾ
Óï·¨£º
SQLÊý¾Ý¿â£º
select case when len(field)>10 then left(field,10)+'...'
else field end as news_name,news_id from tablename
AccessÊý¾Ý¿â£ºSELECT iif(len(field)>2,left(field,2)+'...',field) FROM tablename;
Conn.Execute˵Ã÷
Execute·½·¨¸Ã·½·¨ÓÃÓÚÖ´ÐÐSQLÓï¾ä¡£¸ù¾ÝSQLÓï¾äÖ´ÐкóÊÇ·ñ·µ»Ø¼Ç¼¼¯£¬¸Ã·½·¨µÄʹÓøñʽ·ÖΪÒÔÏÂÁ½ÖÖ£º
1£®Ö´ÐÐSQL²éѯÓï¾äʱ£¬½«·µ»Ø²éѯµÃµ½µÄ¼Ç¼¼¯¡£
Ó÷¨Îª£ºSet ¶ÔÏó±äÁ¿Ãû=Á¬½Ó¶ÔÏó.Execute("SQL ²éѯÓïÑÔ")
Execute·½·¨µ÷Óú󣬻á×Ô¶¯´´½¨¼Ç¼¼¯¶ÔÏ󣬲¢½«²éѯ½á¹û´æ´¢ÔڸüǼ¶ÔÏóÖУ¬
ͨ¹ýSet·½·¨£¬½«¼Ç¼¼¯¸³¸øÖ¸¶¨µÄ¶ÔÏ󱣴棬ÒÔºó¶ÔÏó±äÁ¿¾Í´ú±íÁ˸üǼ¼¯¶ÔÏó¡£
2£®Ö´ÐÐSQLµÄ²Ù×÷ÐÔÓïÑÔʱ£¬Ã»ÓмǼ¼¯µÄ·µ»Ø¡£´ËʱÓ÷¨Îª£º
Á¬½Ó¶ÔÏó.Execute "SQL ²Ù×÷ÐÔÓï¾ä" [, RecordAffected][, Option]
¡¤RecordAffected Ϊ¿ÉÑ¡Ï´Ë³ö¿É·ÅÖÃÒ»¸ö±äÁ¿£¬SQLÓï¾äÖ´Ðкó£¬ËùÉúЧµÄ¼Ç¼Êý»á×Ô¶¯±£´æµ½¸Ã±äÁ¿ÖС£
ͨ¹ý·ÃÎʸñäÁ¿£¬¾Í¿ÉÖªµÀSQLÓï¾ä¶Ó¶àÉÙÌõ¼Ç¼½øÐÐÁ˲Ù×÷¡£
¡¤Option ¿ÉÑ¡Ï¸Ã²ÎÊýµÄȡֵͨ³£ÎªadCMDText£¬ËüÓÃÓÚ¸æËßADO£¬Ó¦¸Ã½«Execute·½·¨Ö®ºóµÄµÚÒ»¸ö×Ö·û½âÊÍΪÃüÁîÎı¾¡£
ͨ¹ýÖ¸¶¨¸Ã²ÎÊý£¬¿ÉʹִÐиü¸ßЧ¡£
¡¤BeginTrans¡¢RollbackTrans¡¢CommitTrans·½·¨
ÕâÈý¸ö·½·¨ÊÇÁ¬½Ó¶ÔÏóÌṩµÄÓÃÓÚÊÂÎñ´¦ÀíµÄ·½·¨¡£BeginTransÓÃÓÚ¿ªÊ¼Ò»¸öÊÂÎRollbackTransÓÃÓڻعöÊÂÎñ£»
CommitTransÓÃÓÚÌá½»ËùÓеÄÊÂÎñ´¦Àí½á¹û£¬¼´È·ÈÏÊÂÎñµÄ´¦Àí¡£
ÊÂÎñ´¦Àí¿ÉÒÔ½«Ò»×é²Ù×÷ÊÓΪһ¸öÕûÌ壬ֻÓÐÈ«²¿Óï¾ä¶¼³É¹¦Ö´Ðкó£¬ÊÂÎñ´¦Àí²ÅËã³É¹¦£»
ÈôÆäÖÐÓÐÒ»¸öÓï¾äÖ´ÐÐʧ°Ü£¬ÔòÕû¸ö´¦Àí¾ÍËãʧ°Ü£¬²¢»Ö¸´µ½´¦ÀïÇ°µÄ״̬¡£
BeginTransºÍCommitTransÓÃÓÚ±ê¼ÇÊÂÎñµÄ¿ªÊ¼ºÍ½áÊø£¬ÔÚÕâÁ½¸öÖ®¼äµÄÓï¾ä£¬¾ÍÊÇ×÷ΪÊÂÎñ´¦ÀíµÄÓï¾ä¡£
ÅжÏÊÂÎñ´¦ÀíÊÇ·ñ³É¹¦£¬¿Éͨ¹ýÁ¬½Ó¶ÔÏóµÄError¼¯ºÏÀ´ÊµÏÖ£¬ÈôError¼¯ºÏµÄ³ÉÔ±¸öÊý²»Îª0£¬Ôò˵Ã÷ÓдíÎó·¢Éú£¬ÊÂÎñ´¦Àíʧ°Ü¡£
Error¼¯ºÏÖеÄÿһ¸öError¶ÔÏ󣬴ú±íÒ»¸ö´íÎóÐÅÏ¢¡£ -
Êý¾Ý¿âÖеĸ߼¶²éѯ
2009-02-19 21:40:49
1 ÔÚ²éѯÖÐʹÓÃÁÐÃ÷
select ÁÐÃû as ¡® ÐÂÁÐÃû' from ±íÃû
//ºÏ²¢ÁÐÈ»ºóÆðÐÂÁÐÃû
select ÁÐÃû+ÁÐÃû as ÐÂÁÐÃû2 ²éѯ¿ÕÐÐ
select ÁÐÃû from ±íÃû where ÁÐÃû is null;
select ÁÐÃû from ±íÃû where ÁÐÃû is not null£»
3 ÔÚ²éѯÖÐʹÓó£Á¿ÁÐÀ´²éѯ±íÃû
select '³£Á¿Öµ'=ÐÂÁÐÃû from ±íÃû
4 ²éѯ·µ»ØÏÞÖƵÄÐÐÊý
select top ÐÐÊý from ±íÃû
select top °Ù·ÖÊý percent from ±íÃû
5²éѯÅÅÐò
select * from ±íÃû order by ÅÅÐòÁÐ acs£¨desc£©
6 ʹÓÃlike Ä£ºý²éѯ
select * from ±íÃû where ÁÐÃû like "Ä£ºýÌõ¼þ"
7 ʹÓÃbetweenÔÚij¸ö·¶Î§ÄÚ½øÐвéѯ
select * from ±íÃû where ÁÐÃû between value1 and valu2
8 ʹÓÃinÔÚÁоÙÖ°ÄÚ½øÐвéѯ
select * from ±íÃû where ÁÐÃû in();
9¾ÛºÏº¯Êýsum
select sum(ÁÐÃû) from ±íÃû£»
select avg(ÁÐÃû) from ±íÃû£»
select max(ÁÐÃû) from ±íÃû;
select min(ÁÐÃû) from ±íÃû£»
select count(ÁÐÃû) from ±íÃû£»
10 ʹÓÃgroup BY½øÐзÖ×é²éѯ£¨ÓеãÄѶȣ©
select ·Ö×éÁÐÃû from ±íÃû group by ·Ö×éÁÐ
16¡¢Ê¹ÓÃhaving×Ó¾ä½øÐзÖ×éɸѡ
select ·Ö×éÁÐÃû from ±íÃû group by ·Ö×éÁÐ having Ìõ¼þ
17 ÄÚÁ¬½Ó
//ÔÚwhere×Ó¾äÖÐÖö¥Á¬½ÓÌõ¼þ
select * from ±íÃû1£¬±íÃû2 where ±íÃû1.ÁÐÃû=±íÃû2.ÁÐÃû
//ÔÚfrom×Ó¾äʹÓá¾inner¡¿join on ±íÃû1. ÁÐÃû=±íÃû2.ÁÐÃû
select * from ±íÃû1 inner jion ±íÃû2 on ±íÃû1.ÁÐÃû=±íÃû2.ÁÐÃû
18 ÍâÁ¬½Ó
// ×óÍâÁ¬½Ó
select * from ±íÃû1 left£¨ritht £© other join ±íÃû2 ±íÃû1.ÁÐÃû=±íÃû2.ÁÐÃû
-
ÈçºÎдÐÔÄܲâÊÔÓÃÀý
2009-02-18 23:51:45
I have decided to release an early draft of this document so that others may provide feedback. Please let me know what you think.
Writing test cases for performance testing requires a different mindset to writing functional test cases. Fortunately it is not a difficult mental leap. This article should give you enough information to get you up and running.
First, lets set out some background and define some terms that are used in performance testing.
- Test case ‡° a test case is the same as a use case or business process. Just as with a functional test case, it outlines test steps that should be performed, and the expected result for each step.
- Test script. ‡° a test script. is a program created by a Performance tester that will perform. all the steps in the test case.
- Virtual user ‡° a virtual user generally runs a single test script. Virtual users do not run test scripts using the Graphical User Interface (like a functional test case that has been automated with tools like WinRunner, QuickTest, QARun or Rational Robot); they simulate a real user by sending the same network traffic as a real user would. A single workstation can run multiple virtual users. [Would a diagram be useful here?]
- Scenario ‡° a performance test scenario is a description of how a set of test scripts will be run. It outlines how many times an hour they will be run, how many users will run each test script, and when each test script. will be run. The aim of a scenario is to simulate real world usage of a system.
Writing a test case for performance testing is basically writing a simple Requirements Specification for a piece of software (the test script). Just as with any specification, it should be unambiguous and as complete as possible.
Every test case will contain the steps to be performed with the application and the expected result for each step. As a performance tester will generally not know the business processes that they will be automating, a test case should provide more detail than may be included in a functional test case intended for a tester familiar with the application.
It is important that the test case describes a single path through the application. Adding conditional branches to handle varying application responses, such as error messages, will greatly increase script. development time and the time taken to verify that the test script. functions as expected. If a test script. encounters an error that it does not expect, it will usually just stop. If the Project Manager decides that test scripts should handle errors the same way a real user would, then information should be included on how to reproduce each error condition, and additional scripting time should be included in the project plan.
The main reason a user may be presented with a different flow through the application is the input data that is used. Each test case will be executed with a large amount of input data. Defining data requirements is a critical part of planning for a performance test, and is the most common area to get wrong on a first attempt. It is very easy to forget that certain inputs will present the user with different options.
The other important data issues to identify are any data dependencies and any potential problems with concurrency. Is it important that data is used in some business functions before they are used in others? And, will data modified by virtual users cause other virtual users to fail when they try to use the same data? The test tool can partition the data used by each virtual user if these requirements can be identified. It can be difficult for a performance tester to debug test script. failures with little knowledge of the application, especially if the failures only occur when multiple virtual users are running at once.
One of the most important pieces of information a performance test is designed to discover is the response time of the system under test ‡° both at the overall business function level and at the low level of individual steps in the test case, such as the time it takes for a search to return a result set. Any test cases provided to a performance tester should clearly define the start and end points for any transaction timings that should be included in the test results.
It is important to remember that the test script. is only creating the network traffic that would normally be generated by the application under test. This means that any operations that happen only on the client do not get simulated and therefore do not get included in any transaction timing points. A good example would be a client application that runs on a user’s PC, and communicates with a server. Starting the client application takes 10 seconds and logging in takes 5 seconds but, since only the login is sending network traffic to the server, the transaction timing point will only measure 5 seconds.
Operations that only happen on the client, including the time users take to enter data or spend looking at the screen is simulated with user think time ‡° an intentional delay that is inserted into the test script. If no think time is included, virtual users will execute the steps of the test case as fast as they can, resulting in greater (and unrealistic) load on the system under test. Depending on the sophistication of the performance test tool, the user think time may be automatically excluded from the transaction timing points. Think times are generally inserted outside of any transaction timing points anyhow.
While a functional test case will be run once from start to finish, a performance test case will be run many times (iterated) by the same virtual user in a single scenario. Information on how the test steps will be iterated should be included in the test case. For example, if a test case involves a user logging in and performing a search, and the entire test case is iterated by the virtual user; then a test scenario may be generating too many logins if the real users generally stay logged into the application. [Is there a way to break up this sentence?] A more realistic test case may have the virtual user log in once and then keep doing the same action for as long as the virtual user is run.
When a script. is iterated, consideration should be given to the non-obvious details of how it is iterated. A good example would be a test script. simulating users using an Internet search engine. When the test script. is iterated, simulating a new search operation, should the virtual user establish a new network connection and empty their cache or should every iteration simulate the same user conducting another search?
As all performance test tools have different default behaviours, a good performance tester should clarify this type of detail with business and technical experts. Some performance test tools make these details easier to change than others. If it is not practical to emulate all the attributes of the expected system traffic with a particular tool, then it should be noted as a limitation of the performance test effort, and a technical expert should assess the likely impact.
Hopefully this article has provided some insight into the extra considerations that must be given when writing a performance test case, rather than a functional test case. As with any software specification, a performance test case may need to be refined as questions are raised by the performance tester.
An example test case:
Õª×Ôhttp://www.myloadtest.com/ -
ÐÔÄܲâÊԵĵ÷Ñй¤×÷Ö®ÏòÏîÄ¿¾Àíµ÷ÑÐ
2009-02-18 23:01:09
Ò» ÏòÏîÄ¿¾Àí½øÐе÷ÑÐ
µÚÒ»²½ ÏòÏîÄ¿¾ÀíÁ˽âÐÔÄܲâÊÔ¹¤×÷µÄÄ¿±ê
A¹¤×÷Ä¿±ê
°´Ê±Íê³É °´ÖÊÍê³É
B ÐÔÄܲâÊÔµÄÐÔÖÊ
Õï¶ÏÐÔÖʵÄÐÔÄܲâÊÔ
µ÷ÓÅÐÔÖʵÄÐÔÄܲâÊÔ
¼ì²âÐÔÐÔÄܲâÊÔ
Ò»°ãÔÚÉÏÏß֮ǰ ±ØÐëÒª×öµÄ¾ÍÊÇÕï¶ÏÐÕÐÔÄܲâÊÔ£¬ÔÚ¿ª·¢ºÍ¹¦ÄܲâÊԽ׶ÎÒª½øÐмì²âºÍµ÷ÓÅÐÔÄܲâÊÔ¡£
µÚ¶þ²½ ÏòÏîÄ¿¾ÀíÁ˽⵱ǰµÄ¿ª·¢×´Ì¬
Á˽âÇå³þµ±Ç°¿ª·¢×´Ì¬ºó²ÅÄÜÅжÏÊÇ·ñÓбØÒª¶ÔÆð½øÐÐÐÔÄܲâÊÔ£¬×öʲôÀàÐ͵ÄÐÔÄܲâÊÔ£¬
µÚÈý²½ ÏòÏîÄ¿¾ÀíÁ˽⵱ǰµÄ°æ±¾¿ØÖÆ״̬
°æ±¾¿ØÖƵĺûµ¶ÔÐÔÄܲâÊÔµÄÓÐЧÐÔÓÐ×ÅÖÂÃüµÄÓ°Ïì¡£
µÚËIJ½ ÏòÏîÄ¿¾ÀíÀ´Á˽âÉú²ú»·¾³µÄ»ù±¾Çé¿ö
a ÍøÂ粿Êð b·þÎñÆ÷Ó²¼þ²¿Êð c²Ù×÷ϵͳ²¿Êð
d °²È«ÐÔ²¿Êð e Ó¦ÓÃƽ̨²¿Êð dÊý¾Ý¿âÖеÄÊý¾Ý²¿Êð eÔÚͬһ¸ö·þÎñÆ÷ÉϵÄÆäËû³ÌÐò²¿Êð
µÚÎå²½ ÏòÏîÄ¿¾ÀíÁ˽â²âÊÔ»·¾³µÄ»ù±¾ÐÅÏ¢
µÚÁù²½ ÏòÏîÄ¿¾ÀíÁ˽â²âÊÔµÄÐÔÄÜÖ¸±ê
-
TRUNCATEºÍDeleteÇø±ð
2009-02-16 21:59:17
TRUNCATEºÍDeleteÓÐÒÔϼ¸µãÇø±ð
¡¡¡¡1¡¢TRUNCATEÔÚ¸÷ÖÖ±íÉÏÎÞÂÛÊÇ´óµÄ»¹ÊÇСµÄ¶¼·Ç³£¿ì¡£Èç¹ûÓÐROLLBACKÃüÁîDelete½«±»³·Ïú£¬¶øTRUNCATEÔò²»»á±»³·Ïú¡£
¡¡¡¡2¡¢TRUNCATEÊÇÒ»¸öDDLÓïÑÔ£¬ÏòÆäËûËùÓеÄDDLÓïÑÔÒ»Ñù£¬Ëû½«±»ÒþʽÌá½»£¬²»ÄܶÔTRUNCATEʹÓÃROLLBACKÃüÁî¡£
¡¡¡¡3¡¢TRUNCATE½«ÖØÐÂÉèÖøßˮƽÏߺÍËùÓеÄË÷Òý¡£ÔÚ¶ÔÕû¸ö±íºÍË÷Òý½øÐÐÍêÈ«ä¯ÀÀʱ£¬¾¹ýTRUNCATE²Ù×÷ºóµÄ±í±ÈDelete²Ù×÷ºóµÄ±íÒª¿ìµÃ¶à¡£
¡¡¡¡4¡¢TRUNCATE²»ÄÜ´¥·¢ÈκÎDelete´¥·¢Æ÷¡£
¡¡¡¡5¡¢²»ÄÜÊÚÓèÈκÎÈËÇå¿ÕËûÈ˵ıíµÄȨÏÞ¡£
¡¡¡¡6¡¢µ±±í±»Çå¿Õºó±íºÍ±íµÄË÷Òý½²ÖØÐÂÉèÖóɳõʼ´óС£¬¶ødeleteÔò²»ÄÜ¡£
¡¡¡¡7¡¢²»ÄÜÇå¿Õ¸¸±í¡£TRUNCATE TABLE (schema)table_name Drop(REUSE) STORAGE
ÔÚĬÈÏÊÇ Drop STORAGE µ±Ê¹ÓÃDrop STORAGEʱ½«Ëõ¶Ì±íºÍ±íË÷Òý£¬½«±íÊÕËõµ½×îС·¶Î§£¬²¢ÖØÐÂÉèÖÃNEXT²ÎÊý¡£REUSE STORAGE²»»áËõ¶Ì±í»òÕßµ÷ÕûNEXT²ÎÊýÔÚÌØÊâÇé¿öÏÂʹÓà REUSE STORAGE
Ò»¸öʵ¼ÊÓ¦ÓõĵäÐÍÀý×Ó£º
ÄãÓÃsqlldr¼ÓÔØÒ»¸ö1000Íò¼Ç¼µÄÊý¾Ý±í£¬µ«ÊǼÓÔØÁ˶àÒ»°ëµÄʱºòÄã·¢ÏÖÓÐÎÊÌ⣬
Õâ¸öʱºòÄãÏëÇå¿Õ±íÖØмÓÔØ¡£
ÄÇô×îºÃ reuse storage £¬ÕâÑùÔٴμÓÔؾͲ»ÐèÒªÔÙ´ÎÑ°ÕÒ¿ÕÏпռäÁË -
ϸ˵Èí¼þ²âÊÔ·çÏÕ¼¶±ðµÄÈ·¶¨
2009-02-15 21:39:46
·çÏÕ¼¶±ð´ú±í¡°Èç¹û¸ÃÈí¼þµÄÐèÇ󣨹¦ÄÜÐÔ£©±»¿ª·¢ÈËԱʵÏÖÒÔºó³öÏÖÁËÈí¼þȱÏÝ£¬ÄÇô¸øÓû§ºÍÆóÒµ´øÀ´¶à´óµÄËðʧ£¬ËðʧԽ´ó£¬¼¶±ðÔ½¸ß
·çÏÕ¼¶±ð£¨A¸ß¼¶·çÏÕBÖм¶·çÏÕCµÍ¼¶·çÏÕ£©
ͨ³£Çé¿öÏ¿ÉÓÃËĸöÔÔò×ÛºÏÅжÏÒ»¸öÒµÎñ·çÏÕ¼¶±ð
1 ¹¦ÄÜÀàÐÍ
A¸ß¼¶ Êý¾ÝµÄн¨¡¢¼ÆËã¡¢ÑéÖ¤ BÖм¶ Êý¾ÝÐÞ¸Ä CµÍ¼¶ Êý¾ÝÏÔʾ
2 ÒµÎñÓ°Ïì
A¸ß¼¶ ȨÏ޺Ϸ¨ÐÔ/¾¼ÃËðʧ/ÀûÒæËðʧ BÖм¶ ´íÎóÐÅÏ¢ CµÍ¼¶ ÎÞ
3ʹÓÃƵ¶È
A¸ß¼¶ ·Ç³£Æµ·±/´óÁ¿ B Öм¶ ¾³£ CµÍ¼¶ºÜÉÙ
4ÊÜÓ°Ïì¿Í»§ÊýÁ¿
A¸ß¼¶ ´óÁ¿/Ƶ·± BÖм¶ ×é/Ⱥ CµÍ¼¶ ºÜÉÙ
ÅжÏ
A Á½¸öA»ò×ÅÒ»¸öAÁ½¸öB
B Á½¸öB »òÒ»AÒ»B
C
-
ÈçºÎ¼òµ¥Àí½âÈí¼þ²âÊÔ
2009-02-15 21:17:04
µÚÒ»£ºÈí¼þ²âÊÔ»ú¹¹ µÄÄ¿±ê ¡°´Ù½øÈí¼þÖÊÁ¿¡±
Èí¼þ¿ª·¢»ú¹¹±£Ö¤Èí¼þÖÊÁ¿
µÚ¶þ£º Èí¼þ²âÊÔµ½Ä¿µÄÊÇ·¢ÏÖÈí¼þȱÏÝ
µÚÈý£ºÊ²Ã´ÊÇÈí¼þȱÏÝ
A Èí¼þû×öËüÓ¦¸Ã×öµÄÊÂÇé
BÈí¼þ×öÀ´Ëü²»Ó¦¸Ã×öµÄÊÂÇé
µÚËÄ Èí¼þ²âÊÔÈËÔ±ÔÚµÚÒ»½×¶ÎµÄ¹¤×÷ÈÎÎñ¾ÍÊÇÒªÕÒ³öÈí¼þÓ¦¸Ã×öµ½ÊÂÇéºÍ²»Ó¦¸Ã×öµÄÊÂÇé
-
Èí¼þ²âÊÔ²¿·ÖÖÐÓ¢ÎĶÔÕÕ
2009-02-15 21:00:47
Acceptance testing : ÑéÊÕ²âÊÔ
Acceptance Testing£º¿É½ÓÊÜÐÔ²âÊÔ
Accessibility test : ÈíÌåÊÊÓÃÐÔ²âÊÔ
actual outcome£ºÊµ¼Ê½á¹û
Ad hoc testing : Ëæ»ú²âÊÔ
Algorithm analysis : Ëã·¨·ÖÎö
algorithm£ºËã·¨
Alpha testing : ¦Á²âÊÔ
analysis£º·ÖÎö
anomaly£ºÒì³£
application software£ºÓ¦ÓÃÈí¼þ
Application under test (AUT) : Ëù²âÊÔµÄÓ¦ÓóÌÐò
Architecture : ¹¹¼Ü
Artifact : ¹¤¼þ
ASQ£º×Ô¶¯»¯Èí¼þÖÊÁ¿£¨Automated Software Quality£©
Assertion checking : ¶ÏÑÔ¼ì²é
Association : ¹ØÁª
Audit : Éó¼Æ
audit trail£ºÉó¼Æ¸ú×Ù
Automated Testing£º×Ô¶¯»¯²âÊÔBackus-Naur Form£ºBNF·¶Ê½
baseline£º»ùÏß
Basic Block£º»ù±¾¿é
basis test set£º»ù±¾²âÊÔ¼¯
Behaviour : ÐÐΪ
Bench test : »ù×¼²âÊÔ
benchmark£º±ê¸Ë/Ö¸±ê/»ù×¼
Best practise : ×î¼Ñʵ¼ù
Beta testing : ¦Â²âÊÔ
Black Box Testing£ººÚºÐ²âÊÔ
Blocking bug : ×è°ÐÔ´íÎó
Bottom-up testing : ×Ôµ×ÏòÉϲâÊÔ
boundary value coverage£º±ß½çÖµ¸²¸Ç
boundary value testing£º±ß½çÖµ²âÊÔ
Boundary values : ±ß½çÖµ
Boundry Value Analysis£º±ß½çÖµ·ÖÎö
branch condition combination coverage£º·ÖÖ§Ìõ¼þ×éºÏ¸²¸Ç
branch condition combination testing£º·ÖÖ§Ìõ¼þ×éºÏ²âÊÔ
branch condition coverage£º·ÖÖ§Ìõ¼þ¸²¸Ç
branch condition testing£º·ÖÖ§Ìõ¼þ²âÊÔ
branch condition£º·ÖÖ§Ìõ¼þ
Branch coverage : ·ÖÖ§¸²¸Ç
branch outcome£º·ÖÖ§½á¹û
branch point£º·ÖÖ§µã
branch testing£º·ÖÖ§²âÊÔ
branch£º·ÖÖ§
Breadth Testing£º¹ã¶È²âÊÔ
Brute force testing: Ç¿Á¦²âÊÔ
Buddy test : ºÏ»ï²âÊÔ
Buffer : »º³å
Bug : ´íÎó
Bug bash : ´íÎó´óɨ³ý
bug fix : ´íÎóÐÞÕý
Bug report : ´íÎ󱨸æ
Bug tracking system: ´íÎó¸ú×Ùϵͳ
bug£ºÈ±ÏÝ
Build : ¹¤×÷°æ±¾£¨ÄÚ²¿Ð¡°æ±¾£©
Build Verfication tests(BVTs): °æ±¾ÑéÖ¤²âÊÔ
Build-in : ÄÚÖÃCapability Maturity Model (CMM): ÄÜÁ¦³ÉÊì¶ÈÄ£ÐÍ
Capability Maturity Model Integration (CMMI): ÄÜÁ¦³ÉÊì¶ÈÄ£ÐÍÕûºÏ
capture/playback tool£º²¶»ñ/»Ø·Å¹¤¾ß
Capture/Replay Tool£º²¶»ñ/»Ø·Å¹¤¾ß
CASE£º¼ÆËã»ú¸¨ÖúÈí¼þ¹¤³Ì£¨computer aided software engineering£©
CAST£º¼ÆËã»ú¸¨Öú²âÊÔ
cause-effect graph£ºÒò¹ûͼ
certification £ºÖ¤Ã÷
change control£º±ä¸ü¿ØÖÆ
Change Management :±ä¸ü¹ÜÀí
Change Request :±ä¸üÇëÇó
Character Set : ×Ö·û¼¯
Check In :¼ìÈë
Check Out :¼ì³ö
Closeout : ÊÕβ
code audit £º´úÂëÉó¼Æ
Code coverage : ´úÂ븲¸Ç
Code Inspection£º´úÂë¼ìÊÓ
Code page : ´úÂëÒ³
Code rule : ±àÂë¹æ·¶
Code sytle : ±àÂë·ç¸ñ
Code Walkthrough£º´úÂë×߶Á
code-based testing£º»ùÓÚ´úÂëµÄ²âÊÔ
coding standards£º±à³Ì¹æ·¶
Common sense : ³£Ê¶
Compatibility Testing£º¼æÈÝÐÔ²âÊÔ
complete path testing £ºÍêȫ·¾¶²âÊÔ
completeness£ºÍêÕûÐÔ
complexity £º¸´ÔÓÐÔ
Component testing : ×é¼þ²âÊÔ
Component£º×é¼þ
computation data use£º¼ÆËãÊý¾ÝʹÓÃ
computer system security£º¼ÆËã»úϵͳ°²È«ÐÔ
Concurrency user : ²¢·¢Óû§
Condition coverage : Ìõ¼þ¸²¸Ç
condition outcome : Ìõ¼þ½á¹û
condition : Ìõ¼þ
configuration control£ºÅäÖÿØÖÆ
Configuration item : ÅäÖÃÏî
configuration management£ºÅäÖùÜÀí
Configuration testing : ÅäÖòâÊÔ
conformance criterion£º Ò»ÖÂÐÔ±ê×¼
Conformance Testing£º Ò»ÖÂÐÔ²âÊÔ
consistency £º Ò»ÖÂÐÔ
consistency checker£º Ò»ÖÂÐÔ¼ì²éÆ÷
Control flow graph : ¿ØÖÆÁ÷³Ìͼ
control flow graph£º¿ØÖÆÁ÷ͼ
control flow£º¿ØÖÆÁ÷
conversion testing£º×ª»»²âÊÔ
Core team : ºËÐÄС×é
corrective maintenance£º¹ÊÕϼìÐÞ
correctness £ºÕýÈ·ÐÔ
coverage £º¸²¸ÇÂÊ
coverage item£º¸²¸ÇÏî
crash£º±ÀÀ£
criticality analysis£º¹Ø¼üÐÔ·ÖÎö
criticality£º¹Ø¼üÐÔ
CRM(change request management): ±ä¸üÐèÇó¹ÜÀí
Customer-focused mindset : ¿Í»§ÎªÖÐÐĵÄÀíÄîÌåϵ
Cyclomatic complexity : Ȧ¸´ÔÓ¶Èdata corruption£ºÊý¾ÝÎÛȾ
data definition C-use pair£ºÊý¾Ý¶¨ÒåC-useʹÓöÔ
data definition P-use coverage£ºÊý¾Ý¶¨ÒåP-use¸²¸Ç
data definition P-use pair£ºÊý¾Ý¶¨ÒåP-useʹÓöÔ
data definition£ºÊý¾Ý¶¨Òå
data definition-use coverage£ºÊý¾Ý¶¨ÒåʹÓø²¸Ç
data definition-use pair £ºÊý¾Ý¶¨ÒåʹÓöÔ
data definition-use testing£ºÊý¾Ý¶¨ÒåʹÓòâÊÔ
data dictionary£ºÊý¾Ý×Öµä
Data Flow Analysis : Êý¾ÝÁ÷·ÖÎö
data flow analysis£ºÊý¾ÝÁ÷·ÖÎö
data flow coverage£ºÊý¾ÝÁ÷¸²¸Ç
data flow diagram£ºÊý¾ÝÁ÷ͼ
data flow testing£ºÊý¾ÝÁ÷²âÊÔ
data integrity£ºÊý¾ÝÍêÕûÐÔ
data use£ºÊý¾ÝʹÓÃ
data validation£ºÊý¾ÝÈ·ÈÏ
dead code£ºËÀ´úÂë
Debug : µ÷ÊÔ
Debugging£ºµ÷ÊÔ
Decision condition£ºÅж¨Ìõ¼þ
Decision coverage : Åж¨¸²¸Ç
decision coverage£ºÅж¨¸²¸Ç
decision outcome£ºÅж¨½á¹û
decision table£ºÅж¨±í
decision£ºÅж¨
Defect : ȱÏÝ
defect density : ȱÏÝÃܶÈ
Defect Tracking :ȱÏݸú×Ù
Deployment : ²¿Êð
Depth Testing£ºÉî¶È²âÊÔ
design for sustainability :¿ÉÑÓÐøÐÔµÄÉè¼Æ
design of experiments£ºÊµÑéÉè¼Æ
design-based testing£º»ùÓÚÉè¼ÆµÄ²âÊÔ
Desk checking : ×ÀÇ°¼ì²é
desk checking£º×ÀÃæ¼ì²é
Determine Usage Model : È·¶¨Ó¦ÓÃÄ£ÐÍ
Determine Potential Risks : È·¶¨Ç±ÔÚ·çÏÕ
diagnostic£ºÕï¶Ï
DIF(decimation in frequency) : °´ÆµÂʳéÈ¡
dirty testing£º°¹Ôà²âÊÔ
disaster recovery£ºÔÖÄѻָ´
DIT £¨decimation in time£©: °´Ê±¼ä³éÈ¡
documentation testing £ºÎĵµ²âÊÔ
domain testing£ºÓò²âÊÔ
domain£ºÓò
DTP DETAIL TEST PLANÏêϸȷÈϲâÊԼƻ®
Dynamic analysis : ¶¯Ì¬·ÖÎö
dynamic analysis£º¶¯Ì¬·ÖÎö
Dynamic Testing£º¶¯Ì¬²âÊÔ -
¹¦ÄܲâÊÔÁ÷³Ì
2009-02-15 20:24:46
Ò» ¿É²âÐÔת»¯
- ×ÔÈ»ÓïÑÔÃèÊö zÖ÷Òª´ÓÈí¼þ²Ù×÷²ãÃæºÍÓ¦ÓòãÃæÀ´½øÐС£ÔÚÈí¼þ²Ù×÷²ãÃæ½øÐÐ×ÔÈ»ÓïÑÔÃèÊö¾ÍÊÇÏêϸµÄÃèÊöÒ»¸ö×îÖÕÓû§ÔõôÔÚÈí¼þÉϽøÐÐÊäÈëÊý¾Ý£¬µã»÷°´Å¥Àà²Ù×÷£¬ÔÚÈí¼þÓ¦ÓòãÃæ¾ÍÊÇ×îÖÕÓû§Èí¼þÈçºÎ½â¾öÉú»îÉϺ͹¤×÷ÉϵÄʵ¼ÊÎÊÌâ
- ¹æÔòÊáÀí £¨Óá°Èç¹û£¬¡£¡£¡£¡£¡£ÄÇô£¬£¬£¬£¬£¬¡±Óï¾ä¶Ô¹¦Äܵã½øÐÐÊáÀí£¬Ê¹Ö®¼ò½éÃ÷ÀÊ·´Ó³¸Ã¹¦ÄܵãµÄÊäÈëºÍÊä³ö£©½«¶¯×÷ºÍÊä³öͳһ³ÆΪ¡°¶¯×÷¡±
-
Ìõ¼þ¶¯×÷ÌáÁ¶
¶þ ²âÊÔÐèÇó·ÖÎö
-
Óû§ÐèÇóÅж¨±í £¨¹æÔòÊáÀíÊýÁ¿¾ö¶¨ÁËÅж¨±íÖÐÂß¼ÊýÁ¿£©
-
²âÊÔ·½·¨Éú³É¶¨Òå ²âÊÔ¼¶±ð¾ö¶¨²âÊÔÉî¶È£¬Í¬Ê±Ò²¾ö¶¨Á˲âÊÔ·½·¨ £¬²âÊÔ·½·¨ÓеȼÛÀà»®·Ö£¬±ß½çÖµ·¨£¬Òò¹ûͼ·¨£¬Á÷³Ìͼ·¨£¬
-
²âÊÔÓÃÀýÊýÁ¿¹ÀËã
-
²âÊÔ¹¤×÷Á¿µÄ¹ÀË㣨¸ù¾ÝÒÔÍù¾ÑéºÍµ±Ç°¹¤×÷ЧÂʽøÐй¤×÷Ä¿±êºÍ¹¤×÷Á¿µÄ¹ÀË㣩
Èý ²âÊÔÓÃÀý¼¯Éè¼Æ
-
´ý²âÌØÕ÷ £¨=¹æÔòÊáÀí£©
-
·½·¨Ï¸»¯ Ö÷Òª°üÀ¨Ç°¹¦Äܺͺó¹¦ÄÜÒÔ¼°²âÊÔÊý¾Ýµ½×¼±¸µÈ
-
ÌØÕ÷±êʶ
-
ͨ¹ýʧ°Ü×¼Ôò
ËÄ ²âÊÔÓÃÀýʵÏÖ
-
²âÊÔÄ¿µÄ
-
²âÊÔÊý¾Ý
-
²âÊÔ²½Öè
-
Ô¤ÆÚ½á¹û
Îå²âÊÔÓÃÀýÖ´ÐÐ
-
ʲôÊǹ¦ÄܲâÊÔ£¿
2009-02-14 20:58:14
Ìáµ½¹¦ÄܲâÊÔ£¬ÎÒÃDz»µÃ²»ÏÈÎÊ×Ô¼ºÊ²Ã´ÊÇÈí¼þ²âÊÔ£¬Èí¼þ²âÊÔÊÇÀûÓÃÈ˹¤»òÕß×Ô¶¯ÊֶΣ¬À´ÔËÐлò²âÊÔij¸öϵͳµ½¹ý³Ì£¬ÆäÄ¿µÄÔÚÓë¼ìÑéËûÊÇ·ñÂú×ã¹æ¶¨µ½ÐèÇó»òŪÇåÔ¤ÆÚ½á¹ûºÍʵ¼Ê½á¹ûÖ®¼äµ½²î±ð¡££¨IEEEÈí¼þ¹¤³Ì±ê×¼ÊõÓ£¬
Functional testing(¹¦ÄܲâÊÔ)£¬Ò²³ÆΪÐÐΪ²âÊÔ£¬¸ù¾Ý²úÆ·ÌØÕ÷£¬²Ù×÷ÃèÊöºÍÓû§·½°¸£¬²âÊÔÒ»¸ö²úÆ·µ½ÌØÐԺͿɲÙ×÷ÐÐΪÒÔÈ·¶¨ËûÃÇÂú×ãÉè¼ÆÐèÇó¡£
±êÌâËÑË÷
ÎҵĴ浵
Êý¾Ýͳ¼Æ
- ·ÃÎÊÁ¿: 7810
- ÈÕÖ¾Êý: 16
- ½¨Á¢Ê±¼ä: 2009-02-14
- ¸üÐÂʱ¼ä: 2009-04-22