CREATE TABLE [dbo].[CUSTOMER] ( [CUSTOMER_ID] [int] IDENTITY (1, 1) NOT NULL , [EMAIL] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [PASSWORD] [nvarchar] (12) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [FIRST_NAME] [nvarchar] (25) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [LAST_NAME] [nvarchar] (25) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[ORDER] ( [ORDER_ID] [int] IDENTITY (1, 1) NOT NULL , [CUSTOMER_ID] [int] NOT NULL , [ORDER_STATUS] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [CREATION_DATE] [datetime] NOT NULL ) ON [PRIMARY] GO ALTER TABLE [dbo].[CUSTOMER] WITH NOCHECK ADD CONSTRAINT [CUSTOMER_PK] PRIMARY KEY CLUSTERED ( [CUSTOMER_ID] ) ON [PRIMARY] GO ALTER TABLE [dbo].[ORDER] WITH NOCHECK ADD CONSTRAINT [ORDER_PK] PRIMARY KEY CLUSTERED ( [ORDER_ID] ) ON [PRIMARY] GO ALTER TABLE [dbo].[ORDER] WITH NOCHECK ADD CONSTRAINT [DF_ORDER_CREATION_DATE] DEFAULT (getdate()) FOR [CREATION_DATE] GO ALTER TABLE [dbo].[ORDER] ADD CONSTRAINT [CUSTOMER_ORDER_FK1] FOREIGN KEY ( [CUSTOMER_ID] ) REFERENCES [dbo].[CUSTOMER] ( [CUSTOMER_ID] ) GO |