use master
go
if exists (select name from sys.databases where name = 'OgrenciBilgiSistemiDB')
begin
alter database OgrenciBilgiSistemiDB set single_user with rollback immediate -- veritabanı bağlantısını koparmak için özel sorgu
drop database OgrenciBilgiSistemiDB -- veritabanını silen esas sorgu
end
go
create database OgrenciBilgiSistemiDB
go
USE [OgrenciBilgiSistemiDB]
GO
/****** Object: Table [dbo].[Ders] Script Date: 19.07.2024 08:06:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Ders](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Guid] [nvarchar](36) NOT NULL,
[Adi] [nvarchar](100) NOT NULL,
[IsDeleted] [bit] NULL,
CONSTRAINT [PK_Ders] 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].[Ogrenci] Script Date: 19.07.2024 08:06:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Ogrenci](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Guid] [nvarchar](36) NOT NULL,
[SinifId] [int] NOT NULL,
[Adi] [nvarchar](50) NOT NULL,
[Soyadi] [nvarchar](50) NOT NULL,
[DogumTarihi] [datetime] NULL,
[MezunMu] [bit] NOT NULL,
[Uyruk] [int] NOT NULL,
[Cinsiyeti] [int] NOT NULL,
[TcKimlikNo] [nvarchar](11) NULL,
CONSTRAINT [PK_Ogrenci] 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].[OgrenciDers] Script Date: 19.07.2024 08:06:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[OgrenciDers](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Guid] [nvarchar](36) NOT NULL,
[OgrenciId] [int] NOT NULL,
[DersId] [int] NOT NULL,
[Not1] [decimal](5, 1) NULL,
[Not2] [decimal](5, 1) NULL,
[Not3] [decimal](5, 1) NULL,
CONSTRAINT [PK_OgrenciDers] 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].[Sinif] Script Date: 19.07.2024 08:06:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Sinif](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Guid] [nvarchar](36) NOT NULL,
[Adi] [nvarchar](25) NOT NULL,
CONSTRAINT [PK_Sinif] 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].[Ders] ON
INSERT [dbo].[Ders] ([Id], [Guid], [Adi], [IsDeleted]) VALUES (1, N'05411860-41EB-4204-BBEF-D13976106E52', N'Matematik', NULL)
INSERT [dbo].[Ders] ([Id], [Guid], [Adi], [IsDeleted]) VALUES (2, N'616AA128-25BA-4C42-9B40-12F4035B5D34', N'Türkçe', NULL)
INSERT [dbo].[Ders] ([Id], [Guid], [Adi], [IsDeleted]) VALUES (3, N'7E8C4E56-BADA-4476-B4F3-FE190C116374', N'Tarih', 0)
INSERT [dbo].[Ders] ([Id], [Guid], [Adi], [IsDeleted]) VALUES (4, N'D2601377-C34A-41A5-BD19-4D0C3ABE97B0', N'Fizik', 1)
SET IDENTITY_INSERT [dbo].[Ders] OFF
GO
SET IDENTITY_INSERT [dbo].[Ogrenci] ON
INSERT [dbo].[Ogrenci] ([Id], [Guid], [SinifId], [Adi], [Soyadi], [DogumTarihi], [MezunMu], [Uyruk], [Cinsiyeti], [TcKimlikNo]) VALUES (1, N'A01F4E47-5A91-4494-B46D-5991C527CC02', 1, N'Ahmet', N'Yilmaz', CAST(N'2005-03-15T00:00:00.000' AS DateTime), 0, 1, 1, NULL)
INSERT [dbo].[Ogrenci] ([Id], [Guid], [SinifId], [Adi], [Soyadi], [DogumTarihi], [MezunMu], [Uyruk], [Cinsiyeti], [TcKimlikNo]) VALUES (2, N'C8FF16F2-E392-45B6-B87E-AE412F80D54A', 2, N'Ayse', N'Kara', CAST(N'2006-07-22T00:00:00.000' AS DateTime), 0, 1, 2, NULL)
INSERT [dbo].[Ogrenci] ([Id], [Guid], [SinifId], [Adi], [Soyadi], [DogumTarihi], [MezunMu], [Uyruk], [Cinsiyeti], [TcKimlikNo]) VALUES (3, N'464F2CCA-330B-4B60-A673-DD633B80B405', 3, N'Mehmet', N'Çelik', CAST(N'2004-01-30T00:00:00.000' AS DateTime), 1, 1, 1, NULL)
INSERT [dbo].[Ogrenci] ([Id], [Guid], [SinifId], [Adi], [Soyadi], [DogumTarihi], [MezunMu], [Uyruk], [Cinsiyeti], [TcKimlikNo]) VALUES (4, N'7C4FCDBF-DDDC-4389-974D-D87F2D573156', 3, N'Fatma', N'Demir', CAST(N'2005-11-11T00:00:00.000' AS DateTime), 0, 1, 2, NULL)
INSERT [dbo].[Ogrenci] ([Id], [Guid], [SinifId], [Adi], [Soyadi], [DogumTarihi], [MezunMu], [Uyruk], [Cinsiyeti], [TcKimlikNo]) VALUES (5, N'5A7E26B3-CE63-406E-8212-6FF15C36CC76', 2, N'Ali', N'Sahin', CAST(N'2006-05-19T00:00:00.000' AS DateTime), 0, 1, 1, NULL)
INSERT [dbo].[Ogrenci] ([Id], [Guid], [SinifId], [Adi], [Soyadi], [DogumTarihi], [MezunMu], [Uyruk], [Cinsiyeti], [TcKimlikNo]) VALUES (6, N'4822F78A-3F30-4E68-9368-8C8C52BE4333', 1, N'Zeynep', N'Öztürk', CAST(N'2005-09-08T00:00:00.000' AS DateTime), 0, 1, 2, NULL)
INSERT [dbo].[Ogrenci] ([Id], [Guid], [SinifId], [Adi], [Soyadi], [DogumTarihi], [MezunMu], [Uyruk], [Cinsiyeti], [TcKimlikNo]) VALUES (7, N'FEEBF103-7844-44D4-8DA6-EBF48B9F1205', 1, N'Emre', N'Yildirim', CAST(N'2004-12-25T00:00:00.000' AS DateTime), 0, 1, 1, NULL)
INSERT [dbo].[Ogrenci] ([Id], [Guid], [SinifId], [Adi], [Soyadi], [DogumTarihi], [MezunMu], [Uyruk], [Cinsiyeti], [TcKimlikNo]) VALUES (8, N'B0F3C692-0256-4F2F-BAAD-C7D4C695C0F7', 2, N'Elif', N'Aydin', CAST(N'2006-04-02T00:00:00.000' AS DateTime), 0, 1, 2, NULL)
INSERT [dbo].[Ogrenci] ([Id], [Guid], [SinifId], [Adi], [Soyadi], [DogumTarihi], [MezunMu], [Uyruk], [Cinsiyeti], [TcKimlikNo]) VALUES (9, N'6EC784BD-F130-4D4C-8CFF-DE8F9534EDEB', 3, N'Michael', N'Townley', CAST(N'2005-08-14T00:00:00.000' AS DateTime), 0, 2, 1, NULL)
INSERT [dbo].[Ogrenci] ([Id], [Guid], [SinifId], [Adi], [Soyadi], [DogumTarihi], [MezunMu], [Uyruk], [Cinsiyeti], [TcKimlikNo]) VALUES (10, N'A7D92E0D-EC49-4F19-9FC3-3C43051BA1D3', 3, N'Buse', N'Tas', CAST(N'2006-10-30T00:00:00.000' AS DateTime), 1, 1, 2, NULL)
SET IDENTITY_INSERT [dbo].[Ogrenci] OFF
GO
SET IDENTITY_INSERT [dbo].[OgrenciDers] ON
INSERT [dbo].[OgrenciDers] ([Id], [Guid], [OgrenciId], [DersId], [Not1], [Not2], [Not3]) VALUES (1, N'785AEA50-F75F-4AD3-AD44-D2360B8351EF', 1, 1, CAST(90.0 AS Decimal(5, 1)), CAST(80.0 AS Decimal(5, 1)), CAST(70.0 AS Decimal(5, 1)))
INSERT [dbo].[OgrenciDers] ([Id], [Guid], [OgrenciId], [DersId], [Not1], [Not2], [Not3]) VALUES (2, N'5992BCBD-3ECD-4917-BE2D-DC1DE07EAF5C', 2, 1, CAST(45.5 AS Decimal(5, 1)), CAST(50.5 AS Decimal(5, 1)), CAST(40.5 AS Decimal(5, 1)))
INSERT [dbo].[OgrenciDers] ([Id], [Guid], [OgrenciId], [DersId], [Not1], [Not2], [Not3]) VALUES (3, N'7BDBAA89-1E65-4044-9F24-DDE83E38F156', 2, 2, CAST(55.0 AS Decimal(5, 1)), CAST(77.0 AS Decimal(5, 1)), CAST(66.0 AS Decimal(5, 1)))
INSERT [dbo].[OgrenciDers] ([Id], [Guid], [OgrenciId], [DersId], [Not1], [Not2], [Not3]) VALUES (4, N'D2BFAA1A-AF0D-4124-887D-603EDB24A256', 3, 1, CAST(15.0 AS Decimal(5, 1)), CAST(95.0 AS Decimal(5, 1)), CAST(85.0 AS Decimal(5, 1)))
INSERT [dbo].[OgrenciDers] ([Id], [Guid], [OgrenciId], [DersId], [Not1], [Not2], [Not3]) VALUES (5, N'40A46E2C-B3A9-4C87-8BAF-D81FAAC1C262', 3, 2, CAST(5.0 AS Decimal(5, 1)), CAST(75.0 AS Decimal(5, 1)), CAST(44.0 AS Decimal(5, 1)))
INSERT [dbo].[OgrenciDers] ([Id], [Guid], [OgrenciId], [DersId], [Not1], [Not2], [Not3]) VALUES (6, N'F4A2BA4F-9B85-4E62-81CB-80DF12029486', 3, 3, CAST(44.0 AS Decimal(5, 1)), CAST(33.5 AS Decimal(5, 1)), CAST(88.0 AS Decimal(5, 1)))
INSERT [dbo].[OgrenciDers] ([Id], [Guid], [OgrenciId], [DersId], [Not1], [Not2], [Not3]) VALUES (7, N'A7ADDF47-D4A1-4A05-A3B8-ADFF0B36A6C3', 4, 1, CAST(90.0 AS Decimal(5, 1)), CAST(95.0 AS Decimal(5, 1)), CAST(80.0 AS Decimal(5, 1)))
INSERT [dbo].[OgrenciDers] ([Id], [Guid], [OgrenciId], [DersId], [Not1], [Not2], [Not3]) VALUES (8, N'F63CA584-B526-408E-BB14-4571D6C70FA7', 4, 2, CAST(65.5 AS Decimal(5, 1)), CAST(77.0 AS Decimal(5, 1)), CAST(88.0 AS Decimal(5, 1)))
INSERT [dbo].[OgrenciDers] ([Id], [Guid], [OgrenciId], [DersId], [Not1], [Not2], [Not3]) VALUES (9, N'C4D50362-C309-4F46-97A5-0E3A24D3F742', 4, 3, CAST(99.0 AS Decimal(5, 1)), CAST(78.0 AS Decimal(5, 1)), CAST(84.0 AS Decimal(5, 1)))
INSERT [dbo].[OgrenciDers] ([Id], [Guid], [OgrenciId], [DersId], [Not1], [Not2], [Not3]) VALUES (10, N'DB86FD53-6902-44DD-BE71-4311844122A0', 5, 1, CAST(64.0 AS Decimal(5, 1)), CAST(86.0 AS Decimal(5, 1)), CAST(75.0 AS Decimal(5, 1)))
INSERT [dbo].[OgrenciDers] ([Id], [Guid], [OgrenciId], [DersId], [Not1], [Not2], [Not3]) VALUES (11, N'2A77AE03-64C5-4FAD-B9B3-8CBDC559CFA8', 5, 2, CAST(10.0 AS Decimal(5, 1)), CAST(30.0 AS Decimal(5, 1)), CAST(20.0 AS Decimal(5, 1)))
INSERT [dbo].[OgrenciDers] ([Id], [Guid], [OgrenciId], [DersId], [Not1], [Not2], [Not3]) VALUES (12, N'6A222FB7-6D43-40C4-B4CB-8CDEA19A1B86', 6, 1, CAST(99.0 AS Decimal(5, 1)), CAST(77.0 AS Decimal(5, 1)), CAST(88.0 AS Decimal(5, 1)))
INSERT [dbo].[OgrenciDers] ([Id], [Guid], [OgrenciId], [DersId], [Not1], [Not2], [Not3]) VALUES (13, N'14E36EC5-95CE-49A9-9EE9-3E6F77955EFC', 7, 1, CAST(55.0 AS Decimal(5, 1)), CAST(100.0 AS Decimal(5, 1)), CAST(100.0 AS Decimal(5, 1)))
INSERT [dbo].[OgrenciDers] ([Id], [Guid], [OgrenciId], [DersId], [Not1], [Not2], [Not3]) VALUES (14, N'5E195DA4-4EA1-453E-9464-D6B732CDD00F', 8, 1, CAST(15.0 AS Decimal(5, 1)), CAST(50.5 AS Decimal(5, 1)), CAST(70.5 AS Decimal(5, 1)))
INSERT [dbo].[OgrenciDers] ([Id], [Guid], [OgrenciId], [DersId], [Not1], [Not2], [Not3]) VALUES (15, N'35A29556-4846-4982-A0C7-FFE6B42CA9DC', 8, 2, CAST(86.0 AS Decimal(5, 1)), CAST(73.0 AS Decimal(5, 1)), CAST(69.0 AS Decimal(5, 1)))
INSERT [dbo].[OgrenciDers] ([Id], [Guid], [OgrenciId], [DersId], [Not1], [Not2], [Not3]) VALUES (16, N'7E0FCE62-8E42-4EAA-B3A2-215B5AFD4F25', 9, 1, CAST(36.0 AS Decimal(5, 1)), CAST(49.5 AS Decimal(5, 1)), CAST(99.0 AS Decimal(5, 1)))
INSERT [dbo].[OgrenciDers] ([Id], [Guid], [OgrenciId], [DersId], [Not1], [Not2], [Not3]) VALUES (17, N'608E518B-F78B-42C7-AB80-F712E10B391D', 9, 2, CAST(94.0 AS Decimal(5, 1)), CAST(90.0 AS Decimal(5, 1)), CAST(85.0 AS Decimal(5, 1)))
INSERT [dbo].[OgrenciDers] ([Id], [Guid], [OgrenciId], [DersId], [Not1], [Not2], [Not3]) VALUES (18, N'EDAF403F-09D6-4C64-91E0-5D10C6FC5406', 9, 3, CAST(35.0 AS Decimal(5, 1)), CAST(96.0 AS Decimal(5, 1)), CAST(66.0 AS Decimal(5, 1)))
INSERT [dbo].[OgrenciDers] ([Id], [Guid], [OgrenciId], [DersId], [Not1], [Not2], [Not3]) VALUES (19, N'0FD5C0E1-81C8-4772-941C-BFDA3C1C5E5F', 10, 1, CAST(88.0 AS Decimal(5, 1)), CAST(42.0 AS Decimal(5, 1)), CAST(76.0 AS Decimal(5, 1)))
INSERT [dbo].[OgrenciDers] ([Id], [Guid], [OgrenciId], [DersId], [Not1], [Not2], [Not3]) VALUES (20, N'8A633F14-E809-4CCF-B1E3-C442AF35E286', 10, 2, CAST(23.0 AS Decimal(5, 1)), CAST(56.0 AS Decimal(5, 1)), CAST(95.0 AS Decimal(5, 1)))
INSERT [dbo].[OgrenciDers] ([Id], [Guid], [OgrenciId], [DersId], [Not1], [Not2], [Not3]) VALUES (21, N'733D3435-7FA5-4B2F-8606-82EF85837DAE', 10, 3, CAST(56.0 AS Decimal(5, 1)), CAST(76.0 AS Decimal(5, 1)), CAST(86.0 AS Decimal(5, 1)))
SET IDENTITY_INSERT [dbo].[OgrenciDers] OFF
GO
SET IDENTITY_INSERT [dbo].[Sinif] ON
INSERT [dbo].[Sinif] ([Id], [Guid], [Adi]) VALUES (1, N'4CD52030-11C6-4B40-A5B2-70D018A6D9E6', N'1. Sinif')
INSERT [dbo].[Sinif] ([Id], [Guid], [Adi]) VALUES (2, N'C31C8D27-EB89-4CA5-BE37-05D3854DF4AA', N'2. Sinif')
INSERT [dbo].[Sinif] ([Id], [Guid], [Adi]) VALUES (3, N'33889411-3F34-4359-AFD9-C20E514236E6', N'3. Sinif')
SET IDENTITY_INSERT [dbo].[Sinif] OFF
GO
ALTER TABLE [dbo].[Ogrenci] WITH CHECK ADD CONSTRAINT [FK_Ogrenci_Sinif] FOREIGN KEY([SinifId])
REFERENCES [dbo].[Sinif] ([Id])
GO
ALTER TABLE [dbo].[Ogrenci] CHECK CONSTRAINT [FK_Ogrenci_Sinif]
GO
ALTER TABLE [dbo].[OgrenciDers] WITH CHECK ADD CONSTRAINT [FK_OgrenciDers_Ders] FOREIGN KEY([DersId])
REFERENCES [dbo].[Ders] ([Id])
GO
ALTER TABLE [dbo].[OgrenciDers] CHECK CONSTRAINT [FK_OgrenciDers_Ders]
GO
ALTER TABLE [dbo].[OgrenciDers] WITH CHECK ADD CONSTRAINT [FK_OgrenciDers_Ogrenci] FOREIGN KEY([OgrenciId])
REFERENCES [dbo].[Ogrenci] ([Id])
GO
ALTER TABLE [dbo].[OgrenciDers] CHECK CONSTRAINT [FK_OgrenciDers_Ogrenci]
GO