sql 2005
“¹¤ÓûÉÆÆäÊ£¬±ØÏÈÀûÆäÆ÷”¡£ÐÅÏ¢¼¼ÊõÔÚÉÌÒµÁìÓòÓ¦ÓõÄ׿Խ³ÉЧÔÚ¾¹ý½ü20ÄêµÄÐÅÏ¢»¯½¨ÉèÒѾ³õ²½ÏÔÏÖ¡£Æóҵͨ¹ýMIS£¨¹ÜÀíÐÅϢϵͳ£©¿ìËÙÊÕ¼¯ºÍ´¦ÀíÉÌÒµÐÅÏ¢£¬Í¨¹ýERP£¨ÆóÒµ×ÊÔ´¼Æ»®ÏµÍ³£©×¼È·¼à¿ØÐÅÏ¢Á÷£¬´Ó¶ø¶ÔÆóÒµ¾ÓªµÄ¸÷¸ö·½Ãæ½øÐйÜÀí¡£ÕâЩϵͳ³ýÁ˱¾ÉíµÄÓ¦ÓÃÍ⣬»¹»ýÀÛÁË´óÁ¿µÄÊý¾Ý£¬ÈçÀ´×ÔÒµÎñϵͳµÄ¶©µ¥¡¢¿â´æ¡¢½»Ò×ÕËÄ¿¡¢¿Í»§ºÍ¹©Ó¦ÉÌ×ÊÁÏ£¬À´×ÔÆóÒµËù´¦ÐÐÒµºÍ¾ºÕù¶ÔÊÖµÄÊý¾Ý£¬ÒÔ¼°À´×ÔÆóÒµËù´¦µÄÆäËûÍⲿ»·¾³Öеĸ÷ÖÖÊý¾Ý£¬ÕâÊÇÒ»±Ê±¦¹óµÄ²Æ¸»¡£ÐÅϢϵͳӦ¸Ã¾ß±¸°ÑÕâЩÅÓ´óµÄÊý¾Ýת»¯ÎªÖªÊ¶£¬½ø¶ø¸¨ÖúÆóÒµ¾Óª¾ö²ß£¬ÉõÖÁ×Ô¶¯Éú³ÉÉÌÒµ¾ö²ßµÄÄÜÁ¦£¬Õâ¾ÍÊÇÉÌÒµÖÇÄÜ¡£ÐÅϢϵͳÕýÔÚ¾Àú×Å“MIS→ERP→BI”µÄÑݱä¹ý³Ì¡£±¾Õ½«¶ÔÓÚÉÌÒµÖÇÄÜÉæ¼°µ½µÄÏà¹Ø¼¼Êõ£¬ÈçÊý¾Ý²Ö¿â£¨DW£©¡¢Êý¾ÝÍÚ¾ò£¨DM£©µÈ½øÐиÅÒªµØ·ÖÎö£¬Í¬Ê±´ÓÀíÂÛÉÏÃ÷È·ÉÌÒµÖÇÄÜÔÚÆóÒµ¾Óª¾ö²ß¹ý³ÌÖеļÛÖµ·¢»ÓÔÀí¡£
±¾ÕÂÏȼòµ¥µØ˵Ã÷ÆóÒµ¾Óª¹ÜÀí»î¶¯¶ÔÉÌÒµÖÇÄܵÄÐèÇ󣬴ӶøÃ÷ȷʵʩBIµÄÔÒò£¬½â¾öWhyµÄÎÊÌ⣻ÔÙ²ûÊöÉÌÒµÖÇÄܵļ¼Êõ¹¹³É£¬´ó¸ÅÁ˽âÈçºÎʵÏÖÉÌÒµÖÇÄÜ£¬½â¾öWhatºÍHowµÄÎÊÌ⣻×îºóÁоÙһЩʵ¼Ê²¿ÊðµÄ²¿ÊðÉÌÒµÖÇÄÜÏîÄ¿½á¹û£¬½â¾öWhat EffectµÄÎÊÌâ¡£
1.1 ÆóÒµ¾Óª¹ÜÀí»î¶¯¶ÔÉÌÒµÖÇÄܵÄÐèÇó
ÐÅϢϵͳÔÚÆóÒµ¹ÜÀíÖеÄÓ¦Óò»½öËæ׏ÜÀíÀíÄîµÄ¸üжø·¢Õ¹£¬»¹Ôںܴó³Ì¶ÈÉÏÒÀÀµÓÚÆóÒµÉÌÒµÐÅÏ¢µÄ´æ´¢Á¿¡£Ëæ×ÅÉç»á½Ú×àµÄ¼Ó¿ì£¬ÆóÒµÐÅÏ¢»ýÀÛÔ½À´Ô½¶à£¬¶øÉÌҵ֪ʶµÄÐèÇóÈ´µÃ²»µ½Âú×㣬ÓÚÊǾÍÌá³öÁËÉÌÒµÖÇÄܵĸÅÄî¡£ÕâÒ»½Ú½«¶ÔÉÌÒµÖÇÄÜϵͳӦÓõÄÉî²ãÔÒò½øÐÐ̽ÌÖ¡£
1.1.1 ÆóÒµ¾Óª»î¶¯ÃæÁÙµÄÌôÕ½
ÆóÒµ¾Óª»î¶¯°üÀ¨²É¹º¡¢Éú²ú¡¢ÏúÊÛ¡¢ÉÌó´èÉÌ¡¢¼Û¸ñ±È½Ï¡¢¾Óª¾ö²ß¡¢ÓªÏú²ßÂÔ¡¢ÍÆÏú´ÙÏú¡¢¹«¹ØÐû´«¡¢ÊÛÇ°/ÊÛºó·þÎñ¡¢¿Í»§¹ØϵºÍ×Éѯ·þÎñµÈ¡£ÕâЩ»î¶¯µÄ±³ºóʵ¼ÊÉÏÓÐ3ÖÖ“Á÷”ÔÚÖ§³Ö×ÅÕû¸öÆóÒµµÄÔËת£ºÎïÁ÷¡¢×ʽðÁ÷ºÍÐÅÏ¢Á÷¡£
“ÎïÁ÷”ÊÇ´ÓÔ²ÄÁϺÍÁãÅä¼þµ½³ÉÆ·Õû¸öÎï×ÊÁ÷ͨµÄ¹ý³Ì¡£Ëü½«ÔËÊä¡¢²Ö´¢¡¢¼Ó¹¤¡¢ÕûÀíºÍÅäË͵ÈÕû¸öÎï×ÊÁ÷ͨ¹ý³Ìͨ¹ýÐÅÏ¢Óлú½áºÏ£¬ÐγÉÍêÕûµÄ¹©Ó¦ºÍÐèÇóÁ´¡£
“×ʽðÁ÷”ÊÇ×ʽðÔÚÆóÒµÄÚ²¿ºÍÆóÒµÖ®¼äµÄÁ÷¶¯¹ý³Ì¡£Ëü°üÀ¨ÈÚ×Ê¡¢Ó¦ÊÕÕË¿îºÍÓ¦¸¶ÕË¿îµÄ¹ÜÀíµÈ£¬Éæ¼°²ÆÎñµÄ¸÷¸ö·½Ãæ¡£
“ÐÅÏ¢Á÷”ÊÇÆóÒµ¹ÜÀíµÄ¸÷¸ö»·½Ú²úÉúµÄÐÅÏ¢µÄ¹æÂÉÐÔÁ÷¶¯¡£ÈçÒµÎñÔË×÷¹ý³Ì²úÉúµÄµ¥¾Ý¼°Æä´¦Àí¹ý³Ì£»¾Óª¹ÜÀí¹ý³ÌÖеijɱ¾¡¢ÊÕÈë¡¢ÀûÈó±¨±í¼°ÆäÏ໥¹ØÁª£»Õ½ÂÔ¾ö²ß¹æ»®¹ý³ÌÖеIJúÆ·½á¹¹¼°Êг¡¶¨Î»Ð
Ïà¹ØÎĵµ£º
µÚ¶þ²¿·Ö
1.ËùÓÐÄÐÉúµÄÐÕÃû¡¢ÄêÁä:
Select Sname£¬Sage
from student;
2.ËùÓÐÄêÁä´óÓÚ20£¬¼ÆËã»ú¿ÆѧϵѧÉúÃûµ¥:
SELECT Sname
from Student
WHERE Sage>20 AND Sdept='CS';
3.³É¼¨´óÓÚ60µÄѧÉúѧºÅ:
SELECT Sno
from SC
WHERE Grade>60;
4.³É¼¨ÔÚ70µ½80Ö®¼äµÄѧÉúѧºÅ:
SELECT Sno
from SC
......
ORACLEPL/SQL»ù´¡--ÓαêµÄѧϰÀ´Ô´£º
Óαê×ÖÃæÀí½â¾ÍÊÇÓζ¯µÄ¹â±ê¡£
ÓÃÊý¾Ý¿âÓïÑÔÀ´ÃèÊö£ºÓαêÊÇÓ³ÉäÔÚ½á¹û¼¯ÖÐÒ»ÐÐÊý¾ÝÉϵÄλÖÃʵÌ壬ÓÐÁËÓαêÓû§¾Í¿ÉÒÔ·ÃÎʽá¹û¼¯ÖеÄÈÎÒâÒ»ÐÐÊý¾ÝÁË£¬½«Óαê·ÅÖõ½Ä³Ðк󣬼´¿É¶Ô¸ÃÐÐÊý¾Ý½øÐвÙ×÷£¬ÀýÈçÌáÈ¡µ±Ç°ÐеÄÊý¾ÝµÈµÈ¡£
......
where 1=1ÓÐʲôÓã¿ÔÚSQLÓïÑÔÖУ¬Ð´Õâôһ¾ä»°¾Í¸úûдһÑù¡£
select * from table1 where 1=1Óëselect * from table1ÍêȫûÓÐÇø±ð£¬ÉõÖÁ»¹ÓÐÆäËûÐí¶àд·¨£¬1<>2£¬'a'='a','a'<>'b'£¬ÆäÄ¿µÄ¾ÍÖ»ÓÐÒ»¸ö£¬whereµÄÌõ¼þΪÓÀÕ棬µÃµ½µÄ½á¹û¾ÍÊÇδ¼ÓÔ¼ÊøÌõ¼þµÄ¡£
ÔÚSQL×¢Èëʱ»áÓõ½Õâ¸ö£¬ÀýÈçselect * from table1 ......
declare @id varchar(10)
declare @nm varchar(10)
declare @table as table(emp varchar(10),empname varchar(10))
declare CurEmp cursor for select top 6 empid,empname from employee
open CurEmp
fetch next from CurEmp into @id,@nm
While @@fetch_status=0
begin
insert @table(emp,e ......
MS-SQLÖÐsaµÇ¼ʧ°Ü:
¸Ã´íÎó²úÉúµÄÔÒòÊÇÓÉÓÚSQL ServerʹÓÃÁË"½ö Windows"µÄÉí·ÝÑéÖ¤·½Ê½,
Òò´ËÓû§ÎÞ·¨Ê¹ÓÃSQL ServerµÄµÇ¼ÕÊ»§£¨Èç sa £©½øÐÐÁ¬½Ó.½â¾ö·½·¨ÈçÏÂËùʾ:
1.ÔÚ·þÎñÆ÷¶ËʹÓÃÆóÒµ¹ÜÀíÆ÷,²¢ÇÒÑ¡Ôñ"ʹÓà Windows Éí·ÝÑéÖ¤"Á¬½ÓÉÏ SQL Server
²Ù×÷²½Öè:
ÔÚÆóÒµ¹ÜÀíÆ÷ÖÐ
--ÓÒ¼üÄãµÄ·þÎñÆ÷ʵÀý(¾ÍÊÇÄÇ ......