sql³£ÓÃÓï¾ä
use myoa
select * from
delete from department where departmentid=1
insert Department(DepartmentId,DepartmentName) values(1,'¼¼Êõ²¿')
update Department set departmentname='ÐÅÏ¢¼¼Êõ²¿' where departmentid=1
--ɾ³ý±í
drop table department
--ɾ³ýÊý¾Ý¿â
drop database bai
--ͳ¼ÆÊý¾Ý¿â±íÖмǼ
select count(*) as Êý¾Ý¿â¼Ç¼ from Department
Ïà¹ØÎĵµ£º
ÔÚÕâÒ»Ò³ÖУ¬ÎÒÃÇÁгöËùÓÐÔÚÕâ¸öÍøÕ¾ÓÐÁгö SQL Ö¸ÁîµÄÓï·¨¡£ÈôÒª¸üÏ꾡µÄ˵Ã÷£¬ÇëµãѡָÁîÃû³Æ¡£
ÕâÒ»Ò³µÄÄ¿µÄÊÇÌṩһ¸ö¼ò½àµÄ SQL Óï·¨×öΪ¶ÁÕ߲ο¼Ö®Óá£ÎÒÃǽ¨ÒéÄúÏÖÔھͰ´ Control-D ½«±¾Ò³¼ÓÈëÄúµÄ¡ºÎÒµÄ×î°®¡»¡£
Select
SELECT "À¸Î»" from "±í¸ñÃû"
Distinct
SELECT DISTINCT "À¸Î»"
from "±í¸ñÃû"
......
Êý¾Ý¿â²Ù×÷ÏÖÔÚÊÇÏîÄ¿¿ª·¢µÄ¸ù±¾£¬Ñ§Ï°JavaÊ×ÏÈÓ¦¸Ãѧ»áÔõôÑùÁ¬½ÓÊý¾Ý¿â£¬ÓÃJavaÁ¬½ÓÊý¾Ý¿â¿É²»ÏñÓÃDelphiÕâÀ๤¾ßÄÇÑùÉ輸¸öÊôÐÔ¾ÍOK£¬Ëµ¼òµ¥Ò²¼òµ¥£¬Ëµ¸´ÔÓ£¬ÆäʵҲͦ¸´Ôӵ쬶øÇÒºÜÂé·³£¬Èç¹ûÊdzõѧ£¬¸ù±¾²»Äܱ£Ö¤µÚÒ»´Î¾ÍÁ¬½Ó³É¹¦£¬ÏÂÃæÒÔSQL Server 2000ΪÀý£¬ËµËµJavaÁ¬½ÓÊý¾Ý¿âµÄ»ù±¾·½·¨£¬Ò²¼Ç¼һÏÂÐĵá£
1¡¢Ï ......
×î½üÕýÔÚѧϰÓÃSQL×öһЩ¶«Î÷£¬ÔÚÒ»¸öÌû×ÓÉÏÃæ¿´µ½ÕâÆª¶ÔºÜÓаïÖú£¬¾Í×ªÔØµ½ÁË×Ô¼ºµÄBlogÀϣÍû¶Ô´ó¼ÒÒ²ÓаïÖú¡£
SQL²Ù×÷È«¼¯
ÏÂÁÐÓï¾ä²¿·ÖÊÇMssqlÓï¾ä£¬²»¿ÉÒÔÔÚaccessÖÐʹÓá£
SQL·ÖÀࣺ
DDL—Êý¾Ý¶¨ÒåÓïÑÔ(CREATE£¬ALTER£¬DROP£¬DECLARE)
DML—Êý¾Ý²Ù× ......
SQL Server ²éѯ
²éѯµÄʱºòÓ¦¸Ã¾¡Á¿°´ÕÕ¸´ºÏË÷ÒýÖеÄ˳ÐòÀ´×öÌõ¼þ²éѯ£»£¨±ÈÈçIXCÖÐspInterActiveInstance_GetByIDToStatÌõ¼þand ProcessState<>99µÄλÖã©£»
Èç¹ûÔÚ³ÌÐòÖÐÓÐFor»òÕßÊÇForeach£¬ÔÚ´æ´¢¹ý³ÌÖÐÓÖÓÐIF Exists£¬ÄǾÍÒª¿´ÊÇ·ñ¿ÉÒÔÔÚ±íÖмÓÈ븴ºÏË÷ÒýÁË£¬IF Not Exists¿ÉÒÔת»»ÎªIF ExistsÀ´Ê¹ÓÃË÷Òý£» ......
´æ´¢¹ý³Ì¸ú¶¯Ì¬sqlÏà±ÈÓÐÈçÏÂÓŵ㣺
1¡¢ ´æ´¢¹ý³ÌÔÊÐí±ê×¼×é¼þʽ±à³Ì
´æ´¢¹ý³ÌÔÚ±»´´½¨ÒÔºó¿ÉÒÔÔÚ³ÌÐòÖб»¶à´Îµ÷Óöø²»±ØÖØÐ±àд¸Ã´æ´¢¹ý³ÌµÄSQL
Óï¾ä¶øÇÒÊý¾Ý¿âרҵÈËÔ±¿ÉËæÊ±¶Ô´æ´¢¹ý³Ì½øÐÐÐ޸ĵ«¶ÔÓ¦ÓóÌÐòÔ´´úÂëºÁÎÞÓ°ÏìÒò
ΪӦÓóÌÐòÔ´´úÂëÖ»°üº¬´æ´¢¹ý³ÌµÄµ÷ÓÃÓï¾ä´Ó¶ø¼«´óµØÌá¸ßÁ˳ÌÐòµÄ¿ÉÒÆÖ²ÐÔ
2 ¡¢´æ´¢¹ý³Ì ......