Skip to content

Instantly share code, notes, and snippets.

@SlavikArt
Last active January 21, 2024 12:34
Show Gist options
  • Save SlavikArt/e246e2d4de5729d1a47de26c85a17118 to your computer and use it in GitHub Desktop.
Save SlavikArt/e246e2d4de5729d1a47de26c85a17118 to your computer and use it in GitHub Desktop.
Management DB with some data
USE [master]
GO
/****** Object: Database [Management] Script Date: 20.01.2024 14:18:36 ******/
CREATE DATABASE [Management]
CONTAINMENT = NONE
ON PRIMARY
( NAME = N'Management', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL16.SQLSERVER\MSSQL\DATA\Management.mdf' , SIZE = 8192KB , MAXSIZE = UNLIMITED, FILEGROWTH = 65536KB )
LOG ON
( NAME = N'Management_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL16.SQLSERVER\MSSQL\DATA\Management_log.ldf' , SIZE = 8192KB , MAXSIZE = 2048GB , FILEGROWTH = 65536KB )
WITH CATALOG_COLLATION = DATABASE_DEFAULT, LEDGER = OFF
GO
ALTER DATABASE [Management] SET COMPATIBILITY_LEVEL = 160
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [Management].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [Management] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [Management] SET ANSI_NULLS OFF
GO
ALTER DATABASE [Management] SET ANSI_PADDING OFF
GO
ALTER DATABASE [Management] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [Management] SET ARITHABORT OFF
GO
ALTER DATABASE [Management] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [Management] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [Management] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [Management] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [Management] SET CURSOR_DEFAULT GLOBAL
GO
ALTER DATABASE [Management] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [Management] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [Management] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [Management] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [Management] SET DISABLE_BROKER
GO
ALTER DATABASE [Management] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [Management] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [Management] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [Management] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [Management] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [Management] SET READ_COMMITTED_SNAPSHOT OFF
GO
ALTER DATABASE [Management] SET HONOR_BROKER_PRIORITY OFF
GO
ALTER DATABASE [Management] SET RECOVERY FULL
GO
ALTER DATABASE [Management] SET MULTI_USER
GO
ALTER DATABASE [Management] SET PAGE_VERIFY CHECKSUM
GO
ALTER DATABASE [Management] SET DB_CHAINING OFF
GO
ALTER DATABASE [Management] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF )
GO
ALTER DATABASE [Management] SET TARGET_RECOVERY_TIME = 60 SECONDS
GO
ALTER DATABASE [Management] SET DELAYED_DURABILITY = DISABLED
GO
ALTER DATABASE [Management] SET ACCELERATED_DATABASE_RECOVERY = OFF
GO
EXEC sys.sp_db_vardecimal_storage_format N'Management', N'ON'
GO
ALTER DATABASE [Management] SET QUERY_STORE = ON
GO
ALTER DATABASE [Management] SET QUERY_STORE (OPERATION_MODE = READ_WRITE, CLEANUP_POLICY = (STALE_QUERY_THRESHOLD_DAYS = 30), DATA_FLUSH_INTERVAL_SECONDS = 900, INTERVAL_LENGTH_MINUTES = 60, MAX_STORAGE_SIZE_MB = 1000, QUERY_CAPTURE_MODE = AUTO, SIZE_BASED_CLEANUP_MODE = AUTO, MAX_PLANS_PER_QUERY = 200, WAIT_STATS_CAPTURE_MODE = ON)
GO
USE [Management]
GO
/****** Object: Table [dbo].[Address] Script Date: 20.01.2024 14:18:36 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Address](
[id] [int] IDENTITY(1,1) NOT NULL,
[street] [varchar](255) NULL,
[id_city] [int] NOT NULL,
CONSTRAINT [PK__Address__3213E83FEF19DD55] 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
/****** Object: Table [dbo].[Category] Script Date: 20.01.2024 14:18:36 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Category](
[id] [int] IDENTITY(1,1) NOT NULL,
[name] [varchar](255) NULL,
CONSTRAINT [PK__Category__3213E83F075AA918] 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
/****** Object: Table [dbo].[City] Script Date: 20.01.2024 14:18:36 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[City](
[id] [int] IDENTITY(1,1) NOT NULL,
[name] [varchar](255) NULL,
[id_region] [int] NOT NULL,
CONSTRAINT [PK__City__3213E83F38B8835B] 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
/****** Object: Table [dbo].[Country] Script Date: 20.01.2024 14:18:36 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Country](
[id] [int] IDENTITY(1,1) NOT NULL,
[name] [varchar](255) NULL,
CONSTRAINT [PK__Country__3213E83F51DA1D54] 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
/****** Object: Table [dbo].[Delivery] Script Date: 20.01.2024 14:18:36 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Delivery](
[id] [int] IDENTITY(1,1) NOT NULL,
[id_product] [int] NOT NULL,
[id_supplier] [int] NOT NULL,
[price] [decimal](10, 2) NULL,
[quantity] [int] NULL,
[date_of_delivery] [date] NULL,
CONSTRAINT [PK__Delivery__3213E83F0B5383A4] 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
/****** Object: Table [dbo].[Markup] Script Date: 20.01.2024 14:18:36 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Markup](
[id] [int] IDENTITY(1,1) NOT NULL,
[name] [varchar](255) NULL,
[percentage] [decimal](5, 2) NULL,
CONSTRAINT [PK__Markup__3213E83F845AE9BB] 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
/****** Object: Table [dbo].[Measurement] Script Date: 20.01.2024 14:18:36 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Measurement](
[id] [int] IDENTITY(1,1) NOT NULL,
[name] [varchar](255) NULL,
[description] [varchar](255) NULL,
CONSTRAINT [PK__Measurem__3213E83FA1C46838] 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
/****** Object: Table [dbo].[Producer] Script Date: 20.01.2024 14:18:36 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Producer](
[id] [int] IDENTITY(1,1) NOT NULL,
[name] [varchar](255) NULL,
[id_address] [int] NOT NULL,
CONSTRAINT [PK__Producer__3213E83FB842F569] 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
/****** Object: Table [dbo].[Product] Script Date: 20.01.2024 14:18:36 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Product](
[id] [int] IDENTITY(1,1) NOT NULL,
[name] [varchar](255) NULL,
[id_category] [int] NOT NULL,
[price] [decimal](10, 2) NULL,
[quantity] [int] NULL,
[id_producer] [int] NOT NULL,
[id_measurement] [int] NOT NULL,
[id_markup] [int] NOT NULL,
CONSTRAINT [PK__Product__3213E83F0C2832BC] 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
/****** Object: Table [dbo].[Region] Script Date: 20.01.2024 14:18:36 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Region](
[id] [int] IDENTITY(1,1) NOT NULL,
[name] [varchar](255) NULL,
[id_country] [int] NOT NULL,
CONSTRAINT [PK__Region__3213E83F5EFBCBB3] 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
/****** Object: Table [dbo].[Sale] Script Date: 20.01.2024 14:18:36 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Sale](
[id] [int] IDENTITY(1,1) NOT NULL,
[id_product] [int] NOT NULL,
[price] [decimal](10, 2) NULL,
[quantity] [int] NULL,
[date_of_sale] [date] NULL,
CONSTRAINT [PK__Sale__3213E83FF76A3575] 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
/****** Object: Table [dbo].[Supplier] Script Date: 20.01.2024 14:18:36 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Supplier](
[id] [int] IDENTITY(1,1) NOT NULL,
[name] [varchar](255) NULL,
[id_address] [int] NOT NULL,
CONSTRAINT [PK__Supplier__3213E83FA33A852E] 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
SET IDENTITY_INSERT [dbo].[Address] ON
INSERT [dbo].[Address] ([id], [street], [id_city]) VALUES (25, N'Baker Street 221B', 25)
INSERT [dbo].[Address] ([id], [street], [id_city]) VALUES (26, N'Privet Drive 4', 26)
INSERT [dbo].[Address] ([id], [street], [id_city]) VALUES (27, N'Wall Street', 27)
INSERT [dbo].[Address] ([id], [street], [id_city]) VALUES (28, N'Fifth Avenue', 28)
INSERT [dbo].[Address] ([id], [street], [id_city]) VALUES (29, N'Abbey Road', 29)
INSERT [dbo].[Address] ([id], [street], [id_city]) VALUES (30, N'Elm Street', 30)
SET IDENTITY_INSERT [dbo].[Address] OFF
GO
SET IDENTITY_INSERT [dbo].[Category] ON
INSERT [dbo].[Category] ([id], [name]) VALUES (25, N'Electronics')
INSERT [dbo].[Category] ([id], [name]) VALUES (26, N'Books')
INSERT [dbo].[Category] ([id], [name]) VALUES (27, N'Clothing')
INSERT [dbo].[Category] ([id], [name]) VALUES (28, N'Groceries')
INSERT [dbo].[Category] ([id], [name]) VALUES (29, N'Furniture')
INSERT [dbo].[Category] ([id], [name]) VALUES (30, N'Toys')
SET IDENTITY_INSERT [dbo].[Category] OFF
GO
SET IDENTITY_INSERT [dbo].[City] ON
INSERT [dbo].[City] ([id], [name], [id_region]) VALUES (25, N'Paris', 25)
INSERT [dbo].[City] ([id], [name], [id_region]) VALUES (26, N'London', 26)
INSERT [dbo].[City] ([id], [name], [id_region]) VALUES (27, N'New York', 27)
INSERT [dbo].[City] ([id], [name], [id_region]) VALUES (28, N'Tokyo', 28)
INSERT [dbo].[City] ([id], [name], [id_region]) VALUES (29, N'Sydney', 29)
INSERT [dbo].[City] ([id], [name], [id_region]) VALUES (30, N'Moscow', 30)
SET IDENTITY_INSERT [dbo].[City] OFF
GO
SET IDENTITY_INSERT [dbo].[Country] ON
INSERT [dbo].[Country] ([id], [name]) VALUES (25, N'France')
INSERT [dbo].[Country] ([id], [name]) VALUES (26, N'United Kingdom')
INSERT [dbo].[Country] ([id], [name]) VALUES (27, N'United States')
INSERT [dbo].[Country] ([id], [name]) VALUES (28, N'Japan')
INSERT [dbo].[Country] ([id], [name]) VALUES (29, N'Australia')
INSERT [dbo].[Country] ([id], [name]) VALUES (30, N'Russia')
SET IDENTITY_INSERT [dbo].[Country] OFF
GO
SET IDENTITY_INSERT [dbo].[Delivery] ON
INSERT [dbo].[Delivery] ([id], [id_product], [id_supplier], [price], [quantity], [date_of_delivery]) VALUES (31, 25, 25, CAST(100.00 AS Decimal(10, 2)), 50, CAST(N'2024-01-01' AS Date))
INSERT [dbo].[Delivery] ([id], [id_product], [id_supplier], [price], [quantity], [date_of_delivery]) VALUES (32, 26, 26, CAST(200.00 AS Decimal(10, 2)), 40, CAST(N'2024-02-01' AS Date))
INSERT [dbo].[Delivery] ([id], [id_product], [id_supplier], [price], [quantity], [date_of_delivery]) VALUES (33, 27, 27, CAST(150.00 AS Decimal(10, 2)), 60, CAST(N'2024-03-01' AS Date))
INSERT [dbo].[Delivery] ([id], [id_product], [id_supplier], [price], [quantity], [date_of_delivery]) VALUES (34, 28, 28, CAST(120.00 AS Decimal(10, 2)), 70, CAST(N'2024-04-01' AS Date))
INSERT [dbo].[Delivery] ([id], [id_product], [id_supplier], [price], [quantity], [date_of_delivery]) VALUES (35, 29, 29, CAST(180.00 AS Decimal(10, 2)), 80, CAST(N'2024-05-01' AS Date))
INSERT [dbo].[Delivery] ([id], [id_product], [id_supplier], [price], [quantity], [date_of_delivery]) VALUES (36, 30, 30, CAST(210.00 AS Decimal(10, 2)), 90, CAST(N'2024-06-01' AS Date))
SET IDENTITY_INSERT [dbo].[Delivery] OFF
GO
SET IDENTITY_INSERT [dbo].[Markup] ON
INSERT [dbo].[Markup] ([id], [name], [percentage]) VALUES (25, N'Electronics Markup', CAST(15.00 AS Decimal(5, 2)))
INSERT [dbo].[Markup] ([id], [name], [percentage]) VALUES (26, N'Books Markup', CAST(10.00 AS Decimal(5, 2)))
INSERT [dbo].[Markup] ([id], [name], [percentage]) VALUES (27, N'Clothing Markup', CAST(20.00 AS Decimal(5, 2)))
INSERT [dbo].[Markup] ([id], [name], [percentage]) VALUES (28, N'Groceries Markup', CAST(5.00 AS Decimal(5, 2)))
INSERT [dbo].[Markup] ([id], [name], [percentage]) VALUES (29, N'Furniture Markup', CAST(25.00 AS Decimal(5, 2)))
INSERT [dbo].[Markup] ([id], [name], [percentage]) VALUES (30, N'Toys Markup', CAST(30.00 AS Decimal(5, 2)))
SET IDENTITY_INSERT [dbo].[Markup] OFF
GO
SET IDENTITY_INSERT [dbo].[Measurement] ON
INSERT [dbo].[Measurement] ([id], [name], [description]) VALUES (25, N'Kilogram', N'Weight measurement')
INSERT [dbo].[Measurement] ([id], [name], [description]) VALUES (26, N'Meter', N'Length measurement')
INSERT [dbo].[Measurement] ([id], [name], [description]) VALUES (27, N'Liter', N'Volume measurement')
INSERT [dbo].[Measurement] ([id], [name], [description]) VALUES (28, N'Square Meter', N'Area measurement')
INSERT [dbo].[Measurement] ([id], [name], [description]) VALUES (29, N'Cubic Meter', N'Space measurement')
INSERT [dbo].[Measurement] ([id], [name], [description]) VALUES (30, N'Piece', N'Count measurement')
SET IDENTITY_INSERT [dbo].[Measurement] OFF
GO
SET IDENTITY_INSERT [dbo].[Producer] ON
INSERT [dbo].[Producer] ([id], [name], [id_address]) VALUES (25, N'Apple Inc.', 25)
INSERT [dbo].[Producer] ([id], [name], [id_address]) VALUES (26, N'Samsung', 26)
INSERT [dbo].[Producer] ([id], [name], [id_address]) VALUES (27, N'Sony', 27)
INSERT [dbo].[Producer] ([id], [name], [id_address]) VALUES (28, N'LG', 28)
INSERT [dbo].[Producer] ([id], [name], [id_address]) VALUES (29, N'Panasonic', 29)
INSERT [dbo].[Producer] ([id], [name], [id_address]) VALUES (30, N'Philips', 30)
SET IDENTITY_INSERT [dbo].[Producer] OFF
GO
SET IDENTITY_INSERT [dbo].[Product] ON
INSERT [dbo].[Product] ([id], [name], [id_category], [price], [quantity], [id_producer], [id_measurement], [id_markup]) VALUES (25, N'iPhone', 25, CAST(1000.00 AS Decimal(10, 2)), 100, 25, 30, 25)
INSERT [dbo].[Product] ([id], [name], [id_category], [price], [quantity], [id_producer], [id_measurement], [id_markup]) VALUES (26, N'Galaxy', 25, CAST(900.00 AS Decimal(10, 2)), 200, 26, 30, 25)
INSERT [dbo].[Product] ([id], [name], [id_category], [price], [quantity], [id_producer], [id_measurement], [id_markup]) VALUES (27, N'PlayStation', 25, CAST(500.00 AS Decimal(10, 2)), 300, 27, 30, 25)
INSERT [dbo].[Product] ([id], [name], [id_category], [price], [quantity], [id_producer], [id_measurement], [id_markup]) VALUES (28, N'OLED TV', 25, CAST(1500.00 AS Decimal(10, 2)), 400, 28, 30, 25)
INSERT [dbo].[Product] ([id], [name], [id_category], [price], [quantity], [id_producer], [id_measurement], [id_markup]) VALUES (29, N'Lumix Camera', 25, CAST(800.00 AS Decimal(10, 2)), 500, 29, 30, 25)
INSERT [dbo].[Product] ([id], [name], [id_category], [price], [quantity], [id_producer], [id_measurement], [id_markup]) VALUES (30, N'Airfryer', 25, CAST(200.00 AS Decimal(10, 2)), 600, 30, 30, 25)
SET IDENTITY_INSERT [dbo].[Product] OFF
GO
SET IDENTITY_INSERT [dbo].[Region] ON
INSERT [dbo].[Region] ([id], [name], [id_country]) VALUES (25, N'Ile-de-France', 25)
INSERT [dbo].[Region] ([id], [name], [id_country]) VALUES (26, N'England', 26)
INSERT [dbo].[Region] ([id], [name], [id_country]) VALUES (27, N'New York State', 27)
INSERT [dbo].[Region] ([id], [name], [id_country]) VALUES (28, N'Kanto', 28)
INSERT [dbo].[Region] ([id], [name], [id_country]) VALUES (29, N'New South Wales', 29)
INSERT [dbo].[Region] ([id], [name], [id_country]) VALUES (30, N'Central Federal District', 30)
SET IDENTITY_INSERT [dbo].[Region] OFF
GO
SET IDENTITY_INSERT [dbo].[Sale] ON
INSERT [dbo].[Sale] ([id], [id_product], [price], [quantity], [date_of_sale]) VALUES (25, 25, CAST(1100.00 AS Decimal(10, 2)), 50, CAST(N'2024-01-01' AS Date))
INSERT [dbo].[Sale] ([id], [id_product], [price], [quantity], [date_of_sale]) VALUES (26, 26, CAST(990.00 AS Decimal(10, 2)), 60, CAST(N'2024-02-01' AS Date))
INSERT [dbo].[Sale] ([id], [id_product], [price], [quantity], [date_of_sale]) VALUES (27, 27, CAST(550.00 AS Decimal(10, 2)), 70, CAST(N'2024-03-01' AS Date))
INSERT [dbo].[Sale] ([id], [id_product], [price], [quantity], [date_of_sale]) VALUES (28, 28, CAST(1650.00 AS Decimal(10, 2)), 80, CAST(N'2024-04-01' AS Date))
INSERT [dbo].[Sale] ([id], [id_product], [price], [quantity], [date_of_sale]) VALUES (29, 29, CAST(880.00 AS Decimal(10, 2)), 90, CAST(N'2024-05-01' AS Date))
INSERT [dbo].[Sale] ([id], [id_product], [price], [quantity], [date_of_sale]) VALUES (30, 30, CAST(220.00 AS Decimal(10, 2)), 100, CAST(N'2024-06-01' AS Date))
SET IDENTITY_INSERT [dbo].[Sale] OFF
GO
SET IDENTITY_INSERT [dbo].[Supplier] ON
INSERT [dbo].[Supplier] ([id], [name], [id_address]) VALUES (25, N'Best Buy', 25)
INSERT [dbo].[Supplier] ([id], [name], [id_address]) VALUES (26, N'Amazon', 26)
INSERT [dbo].[Supplier] ([id], [name], [id_address]) VALUES (27, N'Walmart', 27)
INSERT [dbo].[Supplier] ([id], [name], [id_address]) VALUES (28, N'Target', 28)
INSERT [dbo].[Supplier] ([id], [name], [id_address]) VALUES (29, N'Costco', 29)
INSERT [dbo].[Supplier] ([id], [name], [id_address]) VALUES (30, N'eBay', 30)
SET IDENTITY_INSERT [dbo].[Supplier] OFF
GO
ALTER TABLE [dbo].[Address] WITH CHECK ADD CONSTRAINT [FK__Address__id_city__3F466844] FOREIGN KEY([id_city])
REFERENCES [dbo].[City] ([id])
GO
ALTER TABLE [dbo].[Address] CHECK CONSTRAINT [FK__Address__id_city__3F466844]
GO
ALTER TABLE [dbo].[City] WITH CHECK ADD CONSTRAINT [FK__City__id_region__3C69FB99] FOREIGN KEY([id_region])
REFERENCES [dbo].[Region] ([id])
GO
ALTER TABLE [dbo].[City] CHECK CONSTRAINT [FK__City__id_region__3C69FB99]
GO
ALTER TABLE [dbo].[Delivery] WITH CHECK ADD CONSTRAINT [FK__Delivery__id_pro__5629CD9C] FOREIGN KEY([id_product])
REFERENCES [dbo].[Product] ([id])
GO
ALTER TABLE [dbo].[Delivery] CHECK CONSTRAINT [FK__Delivery__id_pro__5629CD9C]
GO
ALTER TABLE [dbo].[Delivery] WITH CHECK ADD CONSTRAINT [FK__Delivery__id_sup__44FF419A] FOREIGN KEY([id_supplier])
REFERENCES [dbo].[Supplier] ([id])
GO
ALTER TABLE [dbo].[Delivery] CHECK CONSTRAINT [FK__Delivery__id_sup__44FF419A]
GO
ALTER TABLE [dbo].[Producer] WITH CHECK ADD CONSTRAINT [FK__Producer__id_add__4F7CD00D] FOREIGN KEY([id_address])
REFERENCES [dbo].[Address] ([id])
GO
ALTER TABLE [dbo].[Producer] CHECK CONSTRAINT [FK__Producer__id_add__4F7CD00D]
GO
ALTER TABLE [dbo].[Product] WITH CHECK ADD CONSTRAINT [FK__Product__id_cate__52593CB8] FOREIGN KEY([id_category])
REFERENCES [dbo].[Category] ([id])
GO
ALTER TABLE [dbo].[Product] CHECK CONSTRAINT [FK__Product__id_cate__52593CB8]
GO
ALTER TABLE [dbo].[Product] WITH CHECK ADD CONSTRAINT [FK__Product__id_mark__5535A963] FOREIGN KEY([id_markup])
REFERENCES [dbo].[Markup] ([id])
GO
ALTER TABLE [dbo].[Product] CHECK CONSTRAINT [FK__Product__id_mark__5535A963]
GO
ALTER TABLE [dbo].[Product] WITH CHECK ADD CONSTRAINT [FK__Product__id_meas__5441852A] FOREIGN KEY([id_measurement])
REFERENCES [dbo].[Measurement] ([id])
GO
ALTER TABLE [dbo].[Product] CHECK CONSTRAINT [FK__Product__id_meas__5441852A]
GO
ALTER TABLE [dbo].[Product] WITH CHECK ADD CONSTRAINT [FK__Product__id_prod__534D60F1] FOREIGN KEY([id_producer])
REFERENCES [dbo].[Producer] ([id])
GO
ALTER TABLE [dbo].[Product] CHECK CONSTRAINT [FK__Product__id_prod__534D60F1]
GO
ALTER TABLE [dbo].[Region] WITH CHECK ADD CONSTRAINT [FK__Region__id_count__398D8EEE] FOREIGN KEY([id_country])
REFERENCES [dbo].[Country] ([id])
GO
ALTER TABLE [dbo].[Region] CHECK CONSTRAINT [FK__Region__id_count__398D8EEE]
GO
ALTER TABLE [dbo].[Sale] WITH CHECK ADD CONSTRAINT [FK__Sale__id_product__571DF1D5] FOREIGN KEY([id_product])
REFERENCES [dbo].[Product] ([id])
GO
ALTER TABLE [dbo].[Sale] CHECK CONSTRAINT [FK__Sale__id_product__571DF1D5]
GO
ALTER TABLE [dbo].[Supplier] WITH CHECK ADD CONSTRAINT [FK__Supplier__id_add__4222D4EF] FOREIGN KEY([id_address])
REFERENCES [dbo].[Address] ([id])
GO
ALTER TABLE [dbo].[Supplier] CHECK CONSTRAINT [FK__Supplier__id_add__4222D4EF]
GO
USE [master]
GO
ALTER DATABASE [Management] SET READ_WRITE
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment