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
Ïà¹ØÎĵµ£º
Êý¾Ý¿â²Ù×÷ÏÖÔÚÊÇÏîÄ¿¿ª·¢µÄ¸ù±¾£¬Ñ§Ï°JavaÊ×ÏÈÓ¦¸Ãѧ»áÔõôÑùÁ¬½ÓÊý¾Ý¿â£¬ÓÃJavaÁ¬½ÓÊý¾Ý¿â¿É²»ÏñÓÃDelphiÕâÀ๤¾ßÄÇÑùÉ輸¸öÊôÐÔ¾ÍOK£¬Ëµ¼òµ¥Ò²¼òµ¥£¬Ëµ¸´ÔÓ£¬ÆäʵҲͦ¸´Ôӵ쬶øÇÒºÜÂé·³£¬Èç¹ûÊdzõѧ£¬¸ù±¾²»Äܱ£Ö¤µÚÒ»´Î¾ÍÁ¬½Ó³É¹¦£¬ÏÂÃæÒÔSQL Server 2000ΪÀý£¬ËµËµJavaÁ¬½ÓÊý¾Ý¿âµÄ»ù±¾·½·¨£¬Ò²¼Ç¼һÏÂÐĵá£
1¡¢Ï ......
×î½üÕýÔÚѧϰÓÃSQL×öһЩ¶«Î÷£¬ÔÚÒ»¸öÌû×ÓÉÏÃæ¿´µ½ÕâÆª¶ÔºÜÓаïÖú£¬¾Í×ªÔØµ½ÁË×Ô¼ºµÄBlogÀϣÍû¶Ô´ó¼ÒÒ²ÓаïÖú¡£
SQL²Ù×÷È«¼¯
ÏÂÁÐÓï¾ä²¿·ÖÊÇMssqlÓï¾ä£¬²»¿ÉÒÔÔÚaccessÖÐʹÓá£
SQL·ÖÀࣺ
DDL—Êý¾Ý¶¨ÒåÓïÑÔ(CREATE£¬ALTER£¬DROP£¬DECLARE)
DML—Êý¾Ý²Ù× ......
1) ͳ¼Æ¸÷¸öϵµÄѧÉúÐÅÏ¢
select count(Sname) ×ÜÈËÊý,Sdept from Student group by Sdept
2) ²éѯÐŹÜϵѧÉúµÄ×î´óÄêÁäºÍ×îСÄêÁä
select MAX(Sage) ×î´óÄêÁä,MIN(Sage) ×îСÄêÁä from Student where
Sdept='ÐŹÜϵ'
3) ²éѯÐŹÜϵ×î´óÄêÁäºÍ×îСÄêÁäµÄѧÉúµÄÐÕÃû
select Sname from St ......
SQL Server ²éѯ
²éѯµÄʱºòÓ¦¸Ã¾¡Á¿°´ÕÕ¸´ºÏË÷ÒýÖеÄ˳ÐòÀ´×öÌõ¼þ²éѯ£»£¨±ÈÈçIXCÖÐspInterActiveInstance_GetByIDToStatÌõ¼þand ProcessState<>99µÄλÖã©£»
Èç¹ûÔÚ³ÌÐòÖÐÓÐFor»òÕßÊÇForeach£¬ÔÚ´æ´¢¹ý³ÌÖÐÓÖÓÐIF Exists£¬ÄǾÍÒª¿´ÊÇ·ñ¿ÉÒÔÔÚ±íÖмÓÈ븴ºÏË÷ÒýÁË£¬IF Not Exists¿ÉÒÔת»»ÎªIF ExistsÀ´Ê¹ÓÃË÷Òý£» ......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BuildQuery
{
/// <summary>
/// ʹÓÃÌṩµÄÊý¾Ý½¨Á¢Ò»¸öSQL²éѯ
/// </summary>
public class BuildQuery
{
#region ÀàµÄ±äÁ¿
int numFieldsCount, ......