Skip to content

Instantly share code, notes, and snippets.

@NevermindKT
Created February 5, 2025 12:27
Show Gist options
  • Save NevermindKT/725dfa1ca28cb5de4a322434dc86978a to your computer and use it in GitHub Desktop.
Save NevermindKT/725dfa1ca28cb5de4a322434dc86978a to your computer and use it in GitHub Desktop.
dz1
USE [master]
GO
/****** Object: Database [Store] Script Date: 05.02.2025 14:21:37 ******/
CREATE DATABASE [Store]
CONTAINMENT = NONE
ON PRIMARY
( NAME = N'Store', FILENAME = N'C:\DataBaseMB\Store.mdf' , SIZE = 8192KB , MAXSIZE = UNLIMITED, FILEGROWTH = 65536KB )
LOG ON
( NAME = N'Store_log', FILENAME = N'C:\DataBaseMB\Store_log.ldf' , SIZE = 8192KB , MAXSIZE = 2048GB , FILEGROWTH = 65536KB )
WITH CATALOG_COLLATION = DATABASE_DEFAULT, LEDGER = OFF
GO
ALTER DATABASE [Store] SET COMPATIBILITY_LEVEL = 160
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [Store].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [Store] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [Store] SET ANSI_NULLS OFF
GO
ALTER DATABASE [Store] SET ANSI_PADDING OFF
GO
ALTER DATABASE [Store] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [Store] SET ARITHABORT OFF
GO
ALTER DATABASE [Store] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [Store] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [Store] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [Store] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [Store] SET CURSOR_DEFAULT GLOBAL
GO
ALTER DATABASE [Store] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [Store] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [Store] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [Store] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [Store] SET DISABLE_BROKER
GO
ALTER DATABASE [Store] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [Store] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [Store] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [Store] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [Store] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [Store] SET READ_COMMITTED_SNAPSHOT OFF
GO
ALTER DATABASE [Store] SET HONOR_BROKER_PRIORITY OFF
GO
ALTER DATABASE [Store] SET RECOVERY FULL
GO
ALTER DATABASE [Store] SET MULTI_USER
GO
ALTER DATABASE [Store] SET PAGE_VERIFY CHECKSUM
GO
ALTER DATABASE [Store] SET DB_CHAINING OFF
GO
ALTER DATABASE [Store] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF )
GO
ALTER DATABASE [Store] SET TARGET_RECOVERY_TIME = 60 SECONDS
GO
ALTER DATABASE [Store] SET DELAYED_DURABILITY = DISABLED
GO
ALTER DATABASE [Store] SET ACCELERATED_DATABASE_RECOVERY = OFF
GO
EXEC sys.sp_db_vardecimal_storage_format N'Store', N'ON'
GO
ALTER DATABASE [Store] SET QUERY_STORE = ON
GO
ALTER DATABASE [Store] 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 [Store]
GO
/****** Object: Table [dbo].[Product] Script Date: 05.02.2025 14:21:37 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Product](
[id] [int] IDENTITY(1,1) NOT NULL,
[name] [nvarchar](50) NOT NULL,
[category] [nvarchar](50) NULL,
[price] [real] NULL,
[discount] [real] NULL,
[quantity] [smallint] NULL,
[measurement] [nvarchar](20) NULL,
[producer] [nvarchar](50) NULL,
[supplier] [nvarchar](50) NULL,
[date_of_delivery] [date] NULL,
[expire_date] [date] NULL,
[country] [nvarchar](50) NULL,
CONSTRAINT [PK_Product] 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].[Product] ON
INSERT [dbo].[Product] ([id], [name], [category], [price], [discount], [quantity], [measurement], [producer], [supplier], [date_of_delivery], [expire_date], [country]) VALUES (1, N'Apple', N'Fruits', 20, 1, 100, N'kg', N'Fresh Farms', N'Global Supply Co.', CAST(N'2025-02-01' AS Date), CAST(N'2025-03-01' AS Date), N'USA')
INSERT [dbo].[Product] ([id], [name], [category], [price], [discount], [quantity], [measurement], [producer], [supplier], [date_of_delivery], [expire_date], [country]) VALUES (2, N'Banana', N'Fruits', 80, 5, 150, N'kg', N'Tropical Goods', N'Fruit World', CAST(N'2025-02-02' AS Date), CAST(N'2025-03-05' AS Date), N'Ecuador')
INSERT [dbo].[Product] ([id], [name], [category], [price], [discount], [quantity], [measurement], [producer], [supplier], [date_of_delivery], [expire_date], [country]) VALUES (3, N'Orange Juice', N'Bereveges', 2, 15, 200, N'liters', N'Citrus Co.', N'Healthy Drinks Ltd.', CAST(N'2025-02-03' AS Date), CAST(N'2025-04-01' AS Date), N'Spain')
INSERT [dbo].[Product] ([id], [name], [category], [price], [discount], [quantity], [measurement], [producer], [supplier], [date_of_delivery], [expire_date], [country]) VALUES (4, N'Milk', N'Dairy', 3, 20, 300, N'liters', N'Dairy Best', N'Farm Fresh', CAST(N'2025-02-05' AS Date), CAST(N'2025-05-01' AS Date), N'USA')
INSERT [dbo].[Product] ([id], [name], [category], [price], [discount], [quantity], [measurement], [producer], [supplier], [date_of_delivery], [expire_date], [country]) VALUES (5, N'Cheddar Cheese', N'Dairy', 3, 20, 80, N'kg', N'Cheese Makers', N'Deli Supplies', CAST(N'2025-02-05' AS Date), CAST(N'2025-05-01' AS Date), N'UK')
INSERT [dbo].[Product] ([id], [name], [category], [price], [discount], [quantity], [measurement], [producer], [supplier], [date_of_delivery], [expire_date], [country]) VALUES (6, N'Tomato', N'Vegetables', 1, 10, 120, N'kg', N'Green Gardens', N'Organic Supply', CAST(N'2025-02-06' AS Date), CAST(N'2025-02-25' AS Date), N'Mexico')
INSERT [dbo].[Product] ([id], [name], [category], [price], [discount], [quantity], [measurement], [producer], [supplier], [date_of_delivery], [expire_date], [country]) VALUES (7, N'Cucumber', N'Vegetables', 1, 5, 130, N'kg', N'Farm Fresh', N'Agro Trade', CAST(N'2025-02-07' AS Date), CAST(N'2025-03-01' AS Date), N'Netherlands')
INSERT [dbo].[Product] ([id], [name], [category], [price], [discount], [quantity], [measurement], [producer], [supplier], [date_of_delivery], [expire_date], [country]) VALUES (8, N'Olive Oil', N'Beverages', 5, 30, 60, N'liters', N'Mediterranean Co.', N'Gourmet Imports', CAST(N'2025-02-08' AS Date), CAST(N'2026-02-08' AS Date), N'Greece')
INSERT [dbo].[Product] ([id], [name], [category], [price], [discount], [quantity], [measurement], [producer], [supplier], [date_of_delivery], [expire_date], [country]) VALUES (9, N'Bread', N'Bakery', 1, 0, 250, N'pieces', N'Baker Bros.', N'Daily Foods', CAST(N'2025-02-09' AS Date), CAST(N'2025-02-15' AS Date), N'USA')
INSERT [dbo].[Product] ([id], [name], [category], [price], [discount], [quantity], [measurement], [producer], [supplier], [date_of_delivery], [expire_date], [country]) VALUES (10, N'Yogurt', N'Dairy', 90, 5, 180, N'cups', N'Healthy Dairy', N'Cool Supplies', CAST(N'2025-02-10' AS Date), CAST(N'2025-02-28' AS Date), N'France')
INSERT [dbo].[Product] ([id], [name], [category], [price], [discount], [quantity], [measurement], [producer], [supplier], [date_of_delivery], [expire_date], [country]) VALUES (11, N'Rice', N'Grains', 2, 10, 500, N'kg', N'Golden Grains', N'Staple Foods Ltd.', CAST(N'2025-02-11' AS Date), CAST(N'2026-02-11' AS Date), N'India')
INSERT [dbo].[Product] ([id], [name], [category], [price], [discount], [quantity], [measurement], [producer], [supplier], [date_of_delivery], [expire_date], [country]) VALUES (12, N'Chicken Breast', N'Meat', 4, 50, 90, N'kg', N'Poultry Farm', N'Meat Distributors', CAST(N'2025-02-12' AS Date), CAST(N'2025-03-12' AS Date), N'Brazil')
INSERT [dbo].[Product] ([id], [name], [category], [price], [discount], [quantity], [measurement], [producer], [supplier], [date_of_delivery], [expire_date], [country]) VALUES (13, N'Salmon', N'Seafood', 8, 75, 70, N'kg', N'Ocean Fresh', N'Seafood Supply', CAST(N'2025-02-13' AS Date), CAST(N'2025-03-10' AS Date), N'Norway')
INSERT [dbo].[Product] ([id], [name], [category], [price], [discount], [quantity], [measurement], [producer], [supplier], [date_of_delivery], [expire_date], [country]) VALUES (14, N'Pasta', N'Grains', 1, 20, 400, N'kg', N'Italian Delights', N'Gourmet Foods', CAST(N'2025-02-14' AS Date), CAST(N'2026-02-14' AS Date), N'Italy')
INSERT [dbo].[Product] ([id], [name], [category], [price], [discount], [quantity], [measurement], [producer], [supplier], [date_of_delivery], [expire_date], [country]) VALUES (15, N'Butter', N'Dairy', 2, 15, 150, N'kg', N'Creamy Farms', N'Dairy Wholesale', CAST(N'2025-02-15' AS Date), CAST(N'2025-06-01' AS Date), N'USA')
INSERT [dbo].[Product] ([id], [name], [category], [price], [discount], [quantity], [measurement], [producer], [supplier], [date_of_delivery], [expire_date], [country]) VALUES (16, N'Carrot', N'Vegetables', 1, 5, 140, N'kg', N'Root Farms', N'Green Market', CAST(N'2025-02-16' AS Date), CAST(N'2025-03-01' AS Date), N'Poland')
INSERT [dbo].[Product] ([id], [name], [category], [price], [discount], [quantity], [measurement], [producer], [supplier], [date_of_delivery], [expire_date], [country]) VALUES (17, N'Eggs', N'Dairy', 20, 0, 1000, N'pieces', N'Happy Hens', N'Poultry Supply', CAST(N'2025-02-17' AS Date), CAST(N'2025-03-20' AS Date), N'USA')
INSERT [dbo].[Product] ([id], [name], [category], [price], [discount], [quantity], [measurement], [producer], [supplier], [date_of_delivery], [expire_date], [country]) VALUES (18, N'Canned Beans', N'Canned Goods', 1, 10, 300, N'cans', N'Preserve Co.', N'Long Shelf Ltd.', CAST(N'2025-02-18' AS Date), CAST(N'2027-02-18' AS Date), N'USA')
INSERT [dbo].[Product] ([id], [name], [category], [price], [discount], [quantity], [measurement], [producer], [supplier], [date_of_delivery], [expire_date], [country]) VALUES (19, N'Chocolate Bar', N'Snacks', 1, 15, 400, N'pieces', N'Sweet Treats', N'Confectionery Imports', CAST(N'2025-02-19' AS Date), CAST(N'2026-02-19' AS Date), N'Belgium')
INSERT [dbo].[Product] ([id], [name], [category], [price], [discount], [quantity], [measurement], [producer], [supplier], [date_of_delivery], [expire_date], [country]) VALUES (20, N'Green Tea', N'Beverages', 3, 25, 150, N'boxes', N'Tea Masters', N'Global Beverages', CAST(N'2025-02-20' AS Date), CAST(N'2027-02-20' AS Date), N'China')
SET IDENTITY_INSERT [dbo].[Product] OFF
GO
ALTER TABLE [dbo].[Product] ADD CONSTRAINT [DF_Product_discount] DEFAULT ((0)) FOR [discount]
GO
USE [master]
GO
ALTER DATABASE [Store] SET READ_WRITE
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment