hi allthx you guys for replaying .yes khtan this is homework , but i don't want you to make it for me i just don't understand how to do it , i don't ask for the code i just ask for any tips that helps me to find the solution, i think this is allowed? if not, i'm sorry.about the pricefix price is in product tableand there is also price that is depends of the amount and this one is in orderline table quote: "every customer will receive one with a price of 0"Which table is this ? is it customer table ? Is there a productid column in the customer table ?"there are 2 tables between product and customer"What do you mean by this ?
that's is the hard part for me , product is connected to orderline and orderline connected to order and order connected to customer tableso ther is no direct connection between product table and customer tablebut i think this will be in the orderline table so every time a new product inserted every customer will will get one with a price of 0 in the orderline table (coz the price in the product table will not be zero) but the problem is how to link all of together.i don't know where to start, if i create new product and then link it to orderline then i need orderid then order should exsist , or i have to create order for each customer before ????????ok i will add the tables :CREATE TABLE [product] ( [ProductID] [nvarchar] (2) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Model] [nvarchar] (4) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Description] [nvarchar] (160) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Size1] [nvarchar] (4) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Size2] [nvarchar] (4) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Price] [int] NOT NULL , CONSTRAINT [pk_product] PRIMARY KEY CLUSTERED ( [ProductID] ) ON [PRIMARY] ) ON [PRIMARY]GO CREATE TABLE [orderline] ( [OrderID] [nvarchar] (2) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [ProductID] [nvarchar] (2) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Quantity] [int] NULL , [Unit_price] [int] NULL , CONSTRAINT [PK_ordlineId] PRIMARY KEY CLUSTERED ( [OrderID], [ProductID] ) ON [PRIMARY] , CONSTRAINT [fk_order] FOREIGN KEY ( [OrderID] ) REFERENCES [le_Order] ( [Order_id] ), CONSTRAINT [fk_productId] FOREIGN KEY ( [ProductID] ) REFERENCES [product] ( [ProductID] )) ON [PRIMARY]GO CREATE TABLE [le_Order] ( [Order_id] [nvarchar] (2) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [OrderDate] [smalldatetime] NULL , [Customer_id] [nvarchar] (4) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Salesman_id] [char] (4) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , CONSTRAINT [pk_order] PRIMARY KEY CLUSTERED ( [Order_id] ) ON [PRIMARY] , CONSTRAINT [fk_customer] FOREIGN KEY ( [Customer_id] ) REFERENCES [le_Customer] ( [Customer_id] ), CONSTRAINT [fk_salesman] FOREIGN KEY ( [Salesman_id] ) REFERENCES [employeeProf] ( [EmployeeProfID] )) ON [PRIMARY]GO CREATE TABLE [le_Customer] ( [Customer_id] [nvarchar] (4) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [CustomerName] [nvarchar] (60) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Adress] [nvarchar] (60) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , CONSTRAINT [pk_customer] PRIMARY KEY CLUSTERED ( [Customer_id] ) ON [PRIMARY] ) ON [PRIMARY]GO |