Need your advise to create indexes in the following scenario.
For example, we have a table OrderDetail with the following structure
CREATE TABLE [dbo].[OrderDetail](
[SalesOrderID] [int] NOT NULL,
[SalesOrderDetailID] [int] IDENTITY(1,1) NOT NULL,
[CarrierTrackingNumber] [nvarchar](25) NULL,
[OrderQty] [smallint] NOT NULL,
[ProductID] [int] NOT NULL,
[SpecialOfferID] [int] NOT NULL,
[UnitPrice] [money] NOT NULL,
[UnitPriceDiscount] [money] NOT NULL,
[LineTotal] [numeric](38, 6) NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[ModifiedDate] [datetime] NOT NULL
) ON [PRIMARY]
We use this table in several select statements with various clauses.
1) select salesorderid,CarrierTrackingNumber,orderqty, unitprice,modifieddate from OrderDetail
where productid=776
2) select salesorderid,productid, CarrierTrackingNumber,orderqty, unitprice,modifieddate from OrderDetail
where productid in (775,776,800) and orderqty>2
3) select salesorderid,productid, CarrierTrackingNumber,orderqty, unitprice,modifieddate from OrderDetail
where modifieddate between '01-01-2010' and '01-01-2011'
4) select orderqty, unitprice,modifieddate from OrderDetail
where productid=776 and orderqty<4 and modifieddate between '01-01-2010' and '01-01-2011'
have tried creating indexes with combinations, but ended up with scans and lookups.
Thanks,
Shiva