Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

sql choch02

ch02
--3-4
select * from orders
where 'México D.F.' in
(select City
from Customers
where Orders.CustomerID = Customers.CustomerID )
--3-5
select * from orders
where 'usa' =
(select Country
from Customers
where Orders.CustomerID = Customers.CustomerID )
--4-1
select * from orders
where Exists
(select *
from Customers
where Orders.CustomerID = Customers.CustomerID
and City='México D.F.')
--4-2
select Customers.companyname, Suppliers.companyname,Customers.City from customers,suppliers
where customers.city = suppliers.city
order by city asc
select CompanyName, city from Customers
where City = any
(Select City from Suppliers
where Customers.city = Suppliers.city)
order by city asc
select CompanyName, city from Customers
where exists
(Select * from Suppliers
where Customers.city = Suppliers.city)
order by city asc
--5-1
select CompanyName from Customers
where CustomerID in
(
select CustomerID from Orders
where OrderID in
(
select OrderID from [Order Details]
where quantity >all(
select quantity from Customers c,Orders O,[order details] od
where c.CustomerID = O.CustomerID and O.OrderID = od.OrderID and
CompanyName ='Around the Horn')
)
)
--5-3
select CompanyName from Customers
where CustomerID in
(
select CustomerID from Orders
where OrderID in
(
select OrderID from [order details]
where quantity >any(
select quantity from Customers c,Orders O,[order details] od
where c.CustomerID = O.CustomerID and O.OrderID = od.OrderID and
CompanyName ='Around the Horn')
)
)
--5-6
select CompanyName from Customers
where CustomerID in
(
select CustomerID from Orders
where OrderID in
(
select OrderID from [order details]
where quantity >'3'
)
)
--5-7
select ProductName,UnitPrice from Products
where Exists
(
select * from Suppliers
where city='london' and suppliers.SupplierID = Products.SupplierID )


Ïà¹ØÎĵµ£º

º½¿Õ¹«Ë¾¹ÜÀíϵͳ(VC++ ÓëSQL 2005)

ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
      ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃæ£¬ºóÃæ ......

SQL Server 2008µÄËÄÏîÐÂÌØÐÔ

ÔÚSQL Server 2008ÖУ¬²»½ö¶ÔÔ­ÓÐÐÔÄܽøÐÐÁ˸Ľø£¬»¹Ìí¼ÓÁËÐí¶àÐÂÌØÐÔ£¬±ÈÈçÐÂÌíÁËÊý¾Ý¼¯³É¹¦ÄÜ£¬¸Ä½øÁË·ÖÎö·þÎñ£¬±¨¸æ·þÎñ£¬ÒÔ¼°Office¼¯³ÉµÈµÈ¡£
¡¡¡¡SQL Server¼¯³É·þÎñ
¡¡
¡¡SSIS(SQL Server¼¯³É·þÎñ)ÊÇÒ»¸öǶÈëʽӦÓóÌÐò£¬ÓÃÓÚ¿ª·¢ºÍÖ´ÐÐETL(½âѹËõ¡¢×ª»»ºÍ¼ÓÔØ)°ü¡£SSIS´úÌæÁËSQL
2000µÄDTS¡£ÕûºÏ·þÎñ¹¦ÄܼȰü ......

SQL SERVERÐÞ¸ÄÅÅÐò¹æÔò

1.sp_helpsort
SELECT SERVERPROPERTY ('Collation')
²é¿´ÄãµÄÅÅÐò¹æÔò.
²»¹ýÄãµÄÕâ¸öÓ¦¸ÃºÍ×Ö·û¼¯ÓйØ.
2.¸ü¸Ä·þÎñÆ÷ÅÅÐò¹æÔò
¸ü¸Ä SQL Server 2005 ʵÀýµÄĬÈÏÅÅÐò¹æÔòµÄ²Ù×÷¿ÉÄÜ»á±È½Ï¸´ÔÓ£¬°üÀ¨ÒÔϲ½Ö裺
È·±£¾ßÓÐÖØÐ´´½¨Óû§Êý¾Ý¿â¼°ÕâЩÊý¾Ý¿âÖеÄËùÓжÔÏóËùÐèµÄÈ«²¿ÐÅÏ¢»ò½Å±¾¡£
ʹÓù¤¾ß£¨ÀýÈç´óÈÝÁ ......

SQL ServerÖÐ charÓëvarchar  

¹Ì¶¨³¤¶È(char)Óë¿É±ä³¤¶È(varchar)×Ö·ûÊý¾ÝÀàÐÍ
char[(n)]
³¤¶ÈΪn¸ö×ֽڵĹ̶¨³¤¶ÈÇÒ·ÇUnicodeµÄ×Ö·ûÊý¾Ý¡£n±ØÐëÊÇÒ»¸ö½éÓÚ1ºÍ8,000Ö®¼äµÄÊýÖµ¡£´æ´¢´óСΪn¸ö×Ö½Ú¡£charÔÚSQL-92ÖеÄͬÒå´ÊΪcharacter¡£
varchar[(n)]
³¤¶ÈΪn¸ö×ֽڵĿɱ䳤¶ÈÇÒ·ÇUnicodeµÄ×Ö·ûÊý¾Ý¡£n±ØÐëÊÇÒ»¸ö½éÓÚ1ºÍ8,000Ö®¼äµÄÊýÖµ¡£´æ´¢´óСΪ ......

ͨ¹ý·ÖÎöSQLÓï¾äµÄÖ´Ðмƻ®ÓÅ»¯SQL

ǰÑÔ
      ±¾ÎĵµÖ÷Òª½éÉÜÓëSQLµ÷ÕûÓйصÄÄÚÈÝ£¬ÄÚÈÝÉæ¼°¶à¸ö·½Ã棺SQLÓï¾äÖ´ÐеĹý³Ì¡¢ORACLEÓÅ»¯Æ÷£¬±íÖ®¼äµÄ¹ØÁª£¬ÈçºÎµÃµ½SQLÖ´Ðмƻ®£¬ÈçºÎ·Ö ÎöÖ´Ðмƻ®µÈÄÚÈÝ£¬´Ó¶øÓÉdzµ½ÉîµÄ·½Ê½Á˽âSQLÓÅ»¯µÄ¹ý³Ì£¬Ê¹´ó¼ÒÖð²½²½ÈëSQLµ÷ÕûÖ®ÃÅ£¬È»ºóÄ㽫·¢ÏÖ……¡£
   &nb ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ