Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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 )


Ïà¹ØÎĵµ£º

SQL SERVERµÄ·ÖÀà»ã×Ü

SQL SERVERµÄ·ÖÀà»ã×Ü
SQL SERVERÖÐʹÓÃGROUP BY¶ÔÊý¾Ý½øÐзÖÀà»ã×Ü£¬ÎÒÃÇÒ²¿ÉÒÔʹÓÃWITH ROLLUPºÍWITH CUBEÅäºÏGROUP BY½øÐГÔöÇ¿”Á˵ķÖÀà»ã×Ü£¬ÄÇôËûÃÇÁ½¸öÊÇÈçºÎÔöÇ¿GROUP BYµÄ»ã×ÜÄÜÁ¦µÄÄØ£¿
Ò».¹¦ÄÜÔöÇ¿
1.ʹÓÃWITH ROLLUP
ÓÃÏÂÃæµÄÀý×Ó˵Ã÷,GROUPʹÓÃÁË3¸ö·Ö×é×ֶΣºGROUP BY A, B, C WITH ROLLUP ......

SQL Server 2008ºÍ΢ÈíÊý¾Ýƽ̨¿ª·¢

Microsoft SQL Server
2008ºÍMicrosoftÊý¾Ýƽ̨Ϊ¿ª·¢ÈËÔ±ÌṩÁËÒ»¸ö×ۺϵıà³Ì¼Ü¹¹£¬ÓÃÓÚ´´½¨Õë¶ÔÒÆ¶¯É豸¡¢×ÀÃæµçÄÔ¡¢Web·þÎñÆ÷£¬ºÍÆóÒµ·þÎñÆ÷µÄ»ùÓÚÊý¾ÝµÄ½â
¾ö·½°¸¡£Õâ¸öÊý¾Ý±à³Ì»·¾³½«Êý¾Ý·ÃÎʺ͹ÜÀí¼¯³Éµ½Ò»¸öÓ¦ÓóÌÐòµÄÒµÎñÂß¼­ÖУ¬´Ó¶øÌá¸ßÁË¿ª·¢ÈËÔ±µÄÉú²úÁ¦¡£ËüÌṩÁËÒ»¸öÓÃÓÚ¶ÔÒì¹¹Êý¾ÝÔ´µÄÊý¾Ý·ÃÎʺ͹ÜÀí
µÄ ......

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

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

¹ØÓÚSQL ServerÊý¾Ý¿âÉè¼ÆµÄ¸ÐÎò

×ªÔØ×Ô£ºhttp://www.cnblogs.com/leonbao/archive/2008/03/07/1094821.html
¹ØÓÚSQL ServerÊý¾Ý¿âÉè¼ÆµÄ¸ÐÎò£¬ÇëÖ¸½Ì
ÓÐÎÊÌâµÄʱºò£¬ÎÒ¾­³£»ØÀ´²©¿Í԰ѰÕҴ𰸣¬¾Ã¶ø¾ÃÖ®£¬×ܽáÁËһЩ¶«Î÷¡£
Íý×ԷƱ¡£¬Çë´ó¼Ò¶àÖ¸³ö´íÎ󣬲¢¸ø³öÒâ¼û
Êý¾Ý¿âÉè¼ÆÈý·¶Ê½»ù±¾Ô­Ôò
µÚÒ»·¶Ê½£ºÊý¾Ý¿â±íÖеÄ×ֶζ¼Êǵ¥Ò»ÊôÐԵ쬲»¿ÉÔÙ·Ö¡£Õâ ......

ASP.NETÖÐtreeviewÓ¦Óã¨ÓÃSQL×÷Êý¾ÝÔ´£©


treeview.aspxÖдúÂëÈçÏ£º
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="treeview.aspx.cs" Inherits="treeview" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ