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 "±í¸ñÃû"
......
×î½üÕýÔÚѧϰÓÃ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À´Ê¹ÓÃË÷Òý£» ......