USE [SalesDB]
GO
/****** Object: Table [dbo].[Orders] Script Date: 15/03/2026 11:24:47 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Orders](
[Id] [int] IDENTITY(1,1) NOT NULL,
[CustomerId] [int] NOT NULL,
[Product] [nvarchar](100) NOT NULL,
[Amount] [decimal](10, 2) NOT NULL,
[Status] [bit] NOT NULL,
PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Orders] WITH CHECK ADD CONSTRAINT [FK_Orders_Customers] FOREIGN KEY([CustomerId])
REFERENCES [dbo].[Customers] ([Id])
GO
ALTER TABLE [dbo].[Orders] CHECK CONSTRAINT [FK_Orders_Customers]
GO
ALTER TABLE [dbo].[Orders]
DROP CONSTRAINT DF_Orders_Status
GO
ALTER TABLE [dbo].[Orders]
ALTER COLUMN Status NVARCHAR(50) NOT NULL
GO
ALTER TABLE [dbo].[Orders]
ADD CONSTRAINT DF_Orders_Status DEFAULT 'Pending' FOR Status
GO
Created
March 15, 2026 11:39
-
-
Save abonello/79872f318f741408f6c6a418c5104465 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment