Skip to content

Instantly share code, notes, and snippets.

@SlavikArt
Created February 13, 2024 21:54
Show Gist options
  • Save SlavikArt/8a5643687971863f05f9a0e0053a88f8 to your computer and use it in GitHub Desktop.
Save SlavikArt/8a5643687971863f05f9a0e0053a88f8 to your computer and use it in GitHub Desktop.
USE [master]
GO
/****** Object: Database [Travel_Agency] Script Date: 13.02.2024 23:53:16 ******/
CREATE DATABASE [Travel_Agency]
CONTAINMENT = NONE
ON PRIMARY
( NAME = N'Travel_Agency', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL16.SQLSERVER\MSSQL\DATA\Travel_Agency.mdf' , SIZE = 8192KB , MAXSIZE = UNLIMITED, FILEGROWTH = 65536KB )
LOG ON
( NAME = N'Travel_Agency_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL16.SQLSERVER\MSSQL\DATA\Travel_Agency_log.ldf' , SIZE = 8192KB , MAXSIZE = 2048GB , FILEGROWTH = 65536KB )
WITH CATALOG_COLLATION = DATABASE_DEFAULT, LEDGER = OFF
GO
ALTER DATABASE [Travel_Agency] SET COMPATIBILITY_LEVEL = 160
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [Travel_Agency].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [Travel_Agency] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [Travel_Agency] SET ANSI_NULLS OFF
GO
ALTER DATABASE [Travel_Agency] SET ANSI_PADDING OFF
GO
ALTER DATABASE [Travel_Agency] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [Travel_Agency] SET ARITHABORT OFF
GO
ALTER DATABASE [Travel_Agency] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [Travel_Agency] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [Travel_Agency] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [Travel_Agency] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [Travel_Agency] SET CURSOR_DEFAULT GLOBAL
GO
ALTER DATABASE [Travel_Agency] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [Travel_Agency] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [Travel_Agency] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [Travel_Agency] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [Travel_Agency] SET DISABLE_BROKER
GO
ALTER DATABASE [Travel_Agency] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [Travel_Agency] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [Travel_Agency] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [Travel_Agency] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [Travel_Agency] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [Travel_Agency] SET READ_COMMITTED_SNAPSHOT OFF
GO
ALTER DATABASE [Travel_Agency] SET HONOR_BROKER_PRIORITY OFF
GO
ALTER DATABASE [Travel_Agency] SET RECOVERY FULL
GO
ALTER DATABASE [Travel_Agency] SET MULTI_USER
GO
ALTER DATABASE [Travel_Agency] SET PAGE_VERIFY CHECKSUM
GO
ALTER DATABASE [Travel_Agency] SET DB_CHAINING OFF
GO
ALTER DATABASE [Travel_Agency] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF )
GO
ALTER DATABASE [Travel_Agency] SET TARGET_RECOVERY_TIME = 60 SECONDS
GO
ALTER DATABASE [Travel_Agency] SET DELAYED_DURABILITY = DISABLED
GO
ALTER DATABASE [Travel_Agency] SET ACCELERATED_DATABASE_RECOVERY = OFF
GO
EXEC sys.sp_db_vardecimal_storage_format N'Travel_Agency', N'ON'
GO
ALTER DATABASE [Travel_Agency] SET QUERY_STORE = ON
GO
ALTER DATABASE [Travel_Agency] 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 [Travel_Agency]
GO
/****** Object: Table [dbo].[Booking_Curort] Script Date: 13.02.2024 23:53:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Booking_Curort](
[ID] [int] IDENTITY(1,1) NOT NULL,
[ID_Human] [int] NULL,
[ID_Tour] [int] NULL,
[ID_Target] [int] NULL,
[DateGo] [date] NULL,
[DateReturn] [date] NULL,
CONSTRAINT [PK_Booking_Curort] 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: 13.02.2024 23:53:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[City](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](50) NULL,
[ID_Country] [int] NULL,
CONSTRAINT [PK_City] 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].[Cost_Travel] Script Date: 13.02.2024 23:53:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Cost_Travel](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Descrip] [nvarchar](max) NULL,
[Price] [int] NULL,
CONSTRAINT [PK_Cost_Travel] 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] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object: Table [dbo].[Country] Script Date: 13.02.2024 23:53:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Country](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](50) NULL,
CONSTRAINT [PK_Country] 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].[Curort] Script Date: 13.02.2024 23:53:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Curort](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](50) NULL,
[Descrip] [nvarchar](max) NULL,
CONSTRAINT [PK_Curort] 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] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object: Table [dbo].[Curort_Tour] Script Date: 13.02.2024 23:53:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Curort_Tour](
[ID_Tour] [int] NULL,
[ID_Curort] [int] NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[Excursion] Script Date: 13.02.2024 23:53:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Excursion](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](50) NULL,
CONSTRAINT [PK_Excursion] 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].[Excursion_Curort] Script Date: 13.02.2024 23:53:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Excursion_Curort](
[ID_Excursion] [int] NULL,
[ID_Curort] [int] NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[Food] Script Date: 13.02.2024 23:53:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Food](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](50) NULL,
CONSTRAINT [PK_Food] 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].[Food_Hotel] Script Date: 13.02.2024 23:53:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Food_Hotel](
[ID_Hotel] [int] NULL,
[ID_Food] [int] NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[Hotel] Script Date: 13.02.2024 23:53:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Hotel](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](50) NULL,
[Descrip] [nvarchar](max) NULL,
[Stars] [int] NULL,
[ID_City] [int] NULL,
CONSTRAINT [PK_Hotel] 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] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object: Table [dbo].[Hotel_Curort] Script Date: 13.02.2024 23:53:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Hotel_Curort](
[ID_Hotel] [int] NULL,
[ID_Curort] [int] NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[Job] Script Date: 13.02.2024 23:53:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Job](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](50) NULL,
CONSTRAINT [PK_Job] 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].[Job_Employment] Script Date: 13.02.2024 23:53:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Job_Employment](
[ID_Person] [int] NULL,
[ID_Job] [int] NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[Payment] Script Date: 13.02.2024 23:53:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Payment](
[ID] [int] IDENTITY(1,1) NOT NULL,
[ID_Human] [int] NULL,
[ID_Tour] [int] NULL,
CONSTRAINT [PK_Payment] 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].[Person] Script Date: 13.02.2024 23:53:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Person](
[ID] [int] IDENTITY(1,1) NOT NULL,
[FName] [nvarchar](50) NULL,
[LName] [nvarchar](50) NULL,
[SName] [nvarchar](50) NULL,
[ID_Sex] [int] NULL,
[ID_City] [int] NULL,
[ID_Job] [int] NULL,
[Birth] [date] NULL,
[ID_Type] [int] NULL,
CONSTRAINT [PK_Person] 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].[Person_Type] Script Date: 13.02.2024 23:53:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Person_Type](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](50) NULL,
CONSTRAINT [PK_Person_Type] 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].[Rating] Script Date: 13.02.2024 23:53:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Rating](
[ID] [int] IDENTITY(1,1) NOT NULL,
[ID_Pers] [int] NULL,
[ID_Curort] [int] NULL,
[Rating] [int] NULL,
[Descrip] [nvarchar](max) NULL,
CONSTRAINT [PK_Rating] 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] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object: Table [dbo].[Relax] Script Date: 13.02.2024 23:53:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Relax](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](50) NULL,
CONSTRAINT [PK_Relax] 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].[Relax_Curort] Script Date: 13.02.2024 23:53:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Relax_Curort](
[ID_Relax] [int] NULL,
[ID_Curort] [int] NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[Rooms] Script Date: 13.02.2024 23:53:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Rooms](
[ID] [int] IDENTITY(1,1) NOT NULL,
[ID_Hotel] [int] NULL,
[ID_Type] [int] NULL,
[Free] [bit] NULL,
CONSTRAINT [PK_Rooms] 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].[Sex] Script Date: 13.02.2024 23:53:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Sex](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](50) NULL,
CONSTRAINT [PK_Sex] 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].[Targer] Script Date: 13.02.2024 23:53:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Targer](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](50) NULL,
CONSTRAINT [PK_Targer] 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].[Time] Script Date: 13.02.2024 23:53:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Time](
[ID] [int] IDENTITY(1,1) NOT NULL,
[DateTime] [datetime] NULL,
CONSTRAINT [PK_Time] 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].[Tour] Script Date: 13.02.2024 23:53:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Tour](
[ID] [int] IDENTITY(1,1) NOT NULL,
[ID_Time] [int] NULL,
[ID_Cost] [int] NULL,
CONSTRAINT [PK_Tour] 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].[Tour_Trans] Script Date: 13.02.2024 23:53:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Tour_Trans](
[ID_Tour] [int] NOT NULL,
[ID_Transport] [int] NOT NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[Transport] Script Date: 13.02.2024 23:53:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Transport](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](50) NULL,
CONSTRAINT [PK_Transport] 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].[Type_Room] Script Date: 13.02.2024 23:53:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Type_Room](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](50) NULL,
CONSTRAINT [PK_Type_Room] 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].[Booking_Curort] WITH CHECK ADD CONSTRAINT [FK_Booking_Curort_Person] FOREIGN KEY([ID_Human])
REFERENCES [dbo].[Person] ([ID])
GO
ALTER TABLE [dbo].[Booking_Curort] CHECK CONSTRAINT [FK_Booking_Curort_Person]
GO
ALTER TABLE [dbo].[Booking_Curort] WITH CHECK ADD CONSTRAINT [FK_Booking_Curort_Targer] FOREIGN KEY([ID_Target])
REFERENCES [dbo].[Targer] ([ID])
GO
ALTER TABLE [dbo].[Booking_Curort] CHECK CONSTRAINT [FK_Booking_Curort_Targer]
GO
ALTER TABLE [dbo].[Booking_Curort] WITH CHECK ADD CONSTRAINT [FK_Booking_Curort_Tour] FOREIGN KEY([ID_Tour])
REFERENCES [dbo].[Tour] ([ID])
GO
ALTER TABLE [dbo].[Booking_Curort] CHECK CONSTRAINT [FK_Booking_Curort_Tour]
GO
ALTER TABLE [dbo].[City] WITH CHECK ADD CONSTRAINT [FK_City_Country] FOREIGN KEY([ID_Country])
REFERENCES [dbo].[Country] ([ID])
GO
ALTER TABLE [dbo].[City] CHECK CONSTRAINT [FK_City_Country]
GO
ALTER TABLE [dbo].[Curort_Tour] WITH CHECK ADD CONSTRAINT [FK_Curort_Tour_Curort] FOREIGN KEY([ID_Curort])
REFERENCES [dbo].[Curort] ([ID])
GO
ALTER TABLE [dbo].[Curort_Tour] CHECK CONSTRAINT [FK_Curort_Tour_Curort]
GO
ALTER TABLE [dbo].[Curort_Tour] WITH CHECK ADD CONSTRAINT [FK_Curort_Tour_Tour] FOREIGN KEY([ID_Tour])
REFERENCES [dbo].[Tour] ([ID])
GO
ALTER TABLE [dbo].[Curort_Tour] CHECK CONSTRAINT [FK_Curort_Tour_Tour]
GO
ALTER TABLE [dbo].[Excursion_Curort] WITH CHECK ADD CONSTRAINT [FK_Excursion_Curort_Curort] FOREIGN KEY([ID_Curort])
REFERENCES [dbo].[Curort] ([ID])
GO
ALTER TABLE [dbo].[Excursion_Curort] CHECK CONSTRAINT [FK_Excursion_Curort_Curort]
GO
ALTER TABLE [dbo].[Excursion_Curort] WITH CHECK ADD CONSTRAINT [FK_Excursion_Curort_Excursion] FOREIGN KEY([ID_Excursion])
REFERENCES [dbo].[Excursion] ([ID])
GO
ALTER TABLE [dbo].[Excursion_Curort] CHECK CONSTRAINT [FK_Excursion_Curort_Excursion]
GO
ALTER TABLE [dbo].[Food_Hotel] WITH CHECK ADD CONSTRAINT [FK_Food_Hotel_Food] FOREIGN KEY([ID_Food])
REFERENCES [dbo].[Food] ([ID])
GO
ALTER TABLE [dbo].[Food_Hotel] CHECK CONSTRAINT [FK_Food_Hotel_Food]
GO
ALTER TABLE [dbo].[Food_Hotel] WITH CHECK ADD CONSTRAINT [FK_Food_Hotel_Hotel] FOREIGN KEY([ID_Hotel])
REFERENCES [dbo].[Hotel] ([ID])
GO
ALTER TABLE [dbo].[Food_Hotel] CHECK CONSTRAINT [FK_Food_Hotel_Hotel]
GO
ALTER TABLE [dbo].[Hotel_Curort] WITH CHECK ADD CONSTRAINT [FK_Hotel_Curort_Curort] FOREIGN KEY([ID_Curort])
REFERENCES [dbo].[Curort] ([ID])
GO
ALTER TABLE [dbo].[Hotel_Curort] CHECK CONSTRAINT [FK_Hotel_Curort_Curort]
GO
ALTER TABLE [dbo].[Hotel_Curort] WITH CHECK ADD CONSTRAINT [FK_Hotel_Curort_Hotel] FOREIGN KEY([ID_Hotel])
REFERENCES [dbo].[Hotel] ([ID])
GO
ALTER TABLE [dbo].[Hotel_Curort] CHECK CONSTRAINT [FK_Hotel_Curort_Hotel]
GO
ALTER TABLE [dbo].[Job_Employment] WITH CHECK ADD CONSTRAINT [FK_Job_Employment_Job] FOREIGN KEY([ID_Job])
REFERENCES [dbo].[Job] ([ID])
GO
ALTER TABLE [dbo].[Job_Employment] CHECK CONSTRAINT [FK_Job_Employment_Job]
GO
ALTER TABLE [dbo].[Job_Employment] WITH CHECK ADD CONSTRAINT [FK_Job_Employment_Person] FOREIGN KEY([ID_Person])
REFERENCES [dbo].[Person] ([ID])
GO
ALTER TABLE [dbo].[Job_Employment] CHECK CONSTRAINT [FK_Job_Employment_Person]
GO
ALTER TABLE [dbo].[Payment] WITH CHECK ADD CONSTRAINT [FK_Payment_Tour] FOREIGN KEY([ID_Tour])
REFERENCES [dbo].[Tour] ([ID])
GO
ALTER TABLE [dbo].[Payment] CHECK CONSTRAINT [FK_Payment_Tour]
GO
ALTER TABLE [dbo].[Person] WITH CHECK ADD CONSTRAINT [FK_Person_City] FOREIGN KEY([ID_City])
REFERENCES [dbo].[City] ([ID])
GO
ALTER TABLE [dbo].[Person] CHECK CONSTRAINT [FK_Person_City]
GO
ALTER TABLE [dbo].[Person] WITH CHECK ADD CONSTRAINT [FK_Person_Person_Type] FOREIGN KEY([ID_Type])
REFERENCES [dbo].[Person_Type] ([ID])
GO
ALTER TABLE [dbo].[Person] CHECK CONSTRAINT [FK_Person_Person_Type]
GO
ALTER TABLE [dbo].[Person] WITH CHECK ADD CONSTRAINT [FK_Person_Sex] FOREIGN KEY([ID_Sex])
REFERENCES [dbo].[Sex] ([ID])
GO
ALTER TABLE [dbo].[Person] CHECK CONSTRAINT [FK_Person_Sex]
GO
ALTER TABLE [dbo].[Rating] WITH CHECK ADD CONSTRAINT [FK_Rating_Curort] FOREIGN KEY([ID_Curort])
REFERENCES [dbo].[Curort] ([ID])
GO
ALTER TABLE [dbo].[Rating] CHECK CONSTRAINT [FK_Rating_Curort]
GO
ALTER TABLE [dbo].[Rating] WITH CHECK ADD CONSTRAINT [FK_Rating_Person] FOREIGN KEY([ID_Pers])
REFERENCES [dbo].[Person] ([ID])
GO
ALTER TABLE [dbo].[Rating] CHECK CONSTRAINT [FK_Rating_Person]
GO
ALTER TABLE [dbo].[Relax_Curort] WITH CHECK ADD CONSTRAINT [FK_Relax_Curort_Curort] FOREIGN KEY([ID_Curort])
REFERENCES [dbo].[Curort] ([ID])
GO
ALTER TABLE [dbo].[Relax_Curort] CHECK CONSTRAINT [FK_Relax_Curort_Curort]
GO
ALTER TABLE [dbo].[Relax_Curort] WITH CHECK ADD CONSTRAINT [FK_Relax_Curort_Relax] FOREIGN KEY([ID_Relax])
REFERENCES [dbo].[Relax] ([ID])
GO
ALTER TABLE [dbo].[Relax_Curort] CHECK CONSTRAINT [FK_Relax_Curort_Relax]
GO
ALTER TABLE [dbo].[Rooms] WITH CHECK ADD CONSTRAINT [FK_Rooms_Hotel] FOREIGN KEY([ID_Hotel])
REFERENCES [dbo].[Hotel] ([ID])
GO
ALTER TABLE [dbo].[Rooms] CHECK CONSTRAINT [FK_Rooms_Hotel]
GO
ALTER TABLE [dbo].[Rooms] WITH CHECK ADD CONSTRAINT [FK_Rooms_Type_Room] FOREIGN KEY([ID_Type])
REFERENCES [dbo].[Type_Room] ([ID])
GO
ALTER TABLE [dbo].[Rooms] CHECK CONSTRAINT [FK_Rooms_Type_Room]
GO
ALTER TABLE [dbo].[Tour] WITH CHECK ADD CONSTRAINT [FK_Tour_Cost_Travel] FOREIGN KEY([ID_Cost])
REFERENCES [dbo].[Cost_Travel] ([ID])
GO
ALTER TABLE [dbo].[Tour] CHECK CONSTRAINT [FK_Tour_Cost_Travel]
GO
ALTER TABLE [dbo].[Tour] WITH CHECK ADD CONSTRAINT [FK_Tour_Time] FOREIGN KEY([ID_Time])
REFERENCES [dbo].[Time] ([ID])
GO
ALTER TABLE [dbo].[Tour] CHECK CONSTRAINT [FK_Tour_Time]
GO
ALTER TABLE [dbo].[Tour_Trans] WITH CHECK ADD CONSTRAINT [FK_Tour_Trans_Tour] FOREIGN KEY([ID_Tour])
REFERENCES [dbo].[Tour] ([ID])
GO
ALTER TABLE [dbo].[Tour_Trans] CHECK CONSTRAINT [FK_Tour_Trans_Tour]
GO
ALTER TABLE [dbo].[Tour_Trans] WITH CHECK ADD CONSTRAINT [FK_Tour_Trans_Transport] FOREIGN KEY([ID_Transport])
REFERENCES [dbo].[Transport] ([ID])
GO
ALTER TABLE [dbo].[Tour_Trans] CHECK CONSTRAINT [FK_Tour_Trans_Transport]
GO
USE [master]
GO
ALTER DATABASE [Travel_Agency] SET READ_WRITE
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment