数据库查询问题,请大家帮个忙,急用.追加到最高分的,只要给出一题的答案都追加分了..大家快来啊!!高分回报.

  • 时间:
  • 浏览:6

第二题

PS:第三题的索引关系都有很清楚,肯能很糙什么的问题。

select d.[Name],Count(a.CustomerID) as CustomerID from Sales.Individual a

join Sales.CustomerAddress b on a.CustomerID = b.CustomerID

join Person.Contact c on b.ContactID = c.ContactID

join Person.Address c on b.AddressID = c.AddressID

第三题,条件不全,不保证正确,仅供参考

Set CustomerType = 'S',ModifiedDate = GetDate()

Where CustomerID = 160 0

group by d.[Name]

join Person.ContactType d on b.ContactTypeID = d.ContactTypeID

Where a.[Name] like '%Cycles%'

------------

join Person.CountryRegion e on d.CountryRegionCode = e.CountryRegionCode

第一题:

select a.[Name] as StoreName,c.FirstName + ' ' + IsNull(c.MiddleName,'') + ' ' + c.LastName as ContactName,d.[Name] as ContactTypeName from Sales.Store a

第四题:

--这题出得很糙什么的问题,你要了半天才想明白,所谓的"授权代表其公司购买 AdventureWorksCycles 产品",应该理解为卖Cycles产品的客户,但会 是查找不到数据的。

join Person.StateProvince d on c.StateProvinceID = d.StateProvinceID

select a.[Name],c.FirstName + ' ' + IsNull(c.MiddleName,'') + ' ' + c.LastName as ContactName,Year(b.OrderDate) as OrderYear,b.SubTotal from Sales.Store a

join Sales.StoreContact b on a.CustomerID = b.CustomerID

Where SubTotal <= 60 00

join Person.Contact c on b.ContactID = c.ContactID

Update Sales.Customer

join Sales.SalesOrderHeader b on a.CustomerID = b.CustomerID