-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bf21204
commit 3571f50
Showing
10 changed files
with
219 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
CREATE DATABASE AnaOkulu | ||
|
||
CREATE TABLE Admin( | ||
AdminID int identity(1,1) PRIMARY KEY NOT NULL, | ||
Kullanici_Adi varchar(30) not null, | ||
Sifre int not null, | ||
|
||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
USE AnaOkulu | ||
|
||
CREATE TABLE Notlar | ||
( | ||
OgrenciTC varchar(11) CONSTRAINT fk_ogrtc FOREIGN KEY REFERENCES Ogrenci(TC) on delete cascade not null, | ||
OgrNot varchar(1) CONSTRAINT ck_not CHECK (OgrNot LIKE '[1-5]') | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
USE AnaOkulu | ||
|
||
CREATE TABLE Ogrenci | ||
( | ||
TC varchar(11) PRIMARY KEY, | ||
Ad varchar(30) NOT NULL, | ||
Soyad varchar (30) NOT NULL, | ||
DogumTarihi date NOT NULL, | ||
KayitTarihi date NOT NULL, | ||
Sinif varchar(3) CONSTRAINT ck_sinif CHECK (Sinif IN ('A','B','C') ), | ||
Adres varchar(150) not null, | ||
|
||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
USE AnaOkulu | ||
|
||
CREATE TABLE Ogretmen | ||
( | ||
OgretmenTC varchar(11) PRIMARY KEY, | ||
Ad varchar(30) NOT NULL, | ||
Soyad varchar (30) NOT NULL, | ||
Sinif varchar(3) CONSTRAINT ck_ogretmensinif CHECK (Sinif IN ('A','B','C') ), | ||
Kullanici_Adi varchar(30) not null, | ||
Sifre varchar(30) not null, | ||
Adres varchar(150) not null, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
|
||
use AnaOkulu | ||
go | ||
create proc SinifA | ||
as | ||
begin | ||
|
||
select TC,Ad,Soyad,n.OgrNot from Ogrenci o Left Outer Join Notlar n on | ||
o.TC=n.OgrenciTC where Sinif like 'A' | ||
|
||
end | ||
|
||
|
||
use AnaOkulu | ||
go | ||
create proc SinifB | ||
as | ||
begin | ||
|
||
select TC,Ad,Soyad,n.OgrNot from Ogrenci o Left Outer Join Notlar n on | ||
o.TC=n.OgrenciTC where Sinif like 'B' | ||
|
||
end | ||
|
||
|
||
use AnaOkulu | ||
go | ||
create proc SinifC | ||
as | ||
begin | ||
|
||
Select TC,Ad,Soyad,n.OgrNot from Ogrenci o Left Outer Join Notlar n on | ||
o.TC=n.OgrenciTC where Sinif like 'C' | ||
|
||
end | ||
|
||
|
||
|
||
use AnaOkulu | ||
go | ||
create proc VeliProc | ||
as | ||
begin | ||
|
||
Select o.TC,o.Ad,o.Soyad,n.OgrNot from Notlar n Inner Join Ogrenci o on | ||
o.TC=n.OgrenciTC Inner Join Veli v on o.Soyad=v.Soyad | ||
|
||
|
||
end | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
CREATE TABLE SilinenOgrenci | ||
( | ||
OgrTC varchar(11) not null, | ||
Ad varchar(30) NOT NULL, | ||
Soyad varchar (30) NOT NULL, | ||
DogumTarihi date NOT NULL, | ||
KayitTarihi date NOT NULL, | ||
Sinif varchar(3) CONSTRAINT ck_siniff CHECK (Sinif IN ('A','B','C') ), | ||
Adres varchar(150) not null, | ||
|
||
) | ||
|
||
CREATE TABLE SilinenVeli | ||
( | ||
VeliTC varchar(11) not null, | ||
Ad varchar(30) not null, | ||
Soyad varchar (30) not null, | ||
Kullanici_Adi varchar(30) not null, | ||
Sifre varchar(20) not null , | ||
Adres varchar(150) , | ||
) | ||
|
||
CREATE TABLE SilinenOgretmen | ||
( | ||
OgretmenTC varchar(11) not null, | ||
Ad varchar(30) NOT NULL, | ||
Soyad varchar (30) NOT NULL, | ||
Sinif varchar(3) CONSTRAINT ck_ogretmensiniff CHECK (Sinif IN ('A','B','C') ), | ||
Kullanici_Adi varchar(30) not null, | ||
Sifre varchar(30) not null, | ||
Adres varchar(150) not null | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
USE AnaOkulu | ||
|
||
CREATE TABLE Veli | ||
( | ||
VeliTC varchar(11) PRIMARY KEY, | ||
Ad varchar(30) not null, | ||
Soyad varchar (30) not null, | ||
Kullanici_Adi varchar(30) not null, | ||
Sifre varchar(20) not null , | ||
Adres varchar(150) , | ||
|
||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
CREATE TRIGGER tr_SilinenOgrenci ON Ogrenci | ||
AFTER DELETE | ||
AS | ||
BEGIN | ||
DECLARE @TC varchar(11) | ||
DECLARE @Ad varchar(20) | ||
DECLARE @Soyad varchar(20) | ||
DECLARE @DogumTarihi date | ||
DECLARE @KayitTarihi date | ||
DECLARE @Sinif varchar(3) | ||
DECLARE @Adres varchar(150) | ||
|
||
SELECT @TC=TC FROM deleted | ||
SELECT @Ad=Ad FROM deleted | ||
SELECT @Soyad=Soyad FROM deleted | ||
SELECT @DogumTarihi=DogumTarihi FROM deleted | ||
SELECT @KayitTarihi=KayitTarihi FROM deleted | ||
SELECT @Sinif=Sinif FROM deleted | ||
SELECT @Adres=Adres FROM deleted | ||
|
||
INSERT INTO SilinenOgrenci VALUES (@TC,@Ad,@Soyad,@DogumTarihi,@KayitTarihi,@Sinif,@Adres) | ||
|
||
END | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
CREATE TRIGGER tr_SilinenOgretmen ON Ogretmen | ||
AFTER DELETE | ||
AS | ||
BEGIN | ||
DECLARE @OgretmenTC varchar(11) | ||
DECLARE @Ad varchar(20) | ||
DECLARE @Soyad varchar(20) | ||
DECLARE @Sinif varchar(3) | ||
DECLARE @Kullanici_Adi varchar(30) | ||
DECLARE @Sifre varchar(20) | ||
DECLARE @Adres varchar(150) | ||
|
||
|
||
SELECT @OgretmenTC=OgretmenTC FROM deleted | ||
SELECT @Ad=Ad FROM deleted | ||
SELECT @Soyad=Soyad FROM deleted | ||
SELECT @Sinif=Sinif FROM deleted | ||
SELECT @Kullanici_Adi=Kullanici_Adi FROM deleted | ||
SELECT @Sifre=Sifre FROM deleted | ||
SELECT @Adres=Adres FROM deleted | ||
|
||
|
||
INSERT INTO SilinenOgretmen VALUES (@OgretmenTC,@Ad,@Soyad,@Sinif,@Kullanici_Adi,@Sifre,@Adres) | ||
|
||
END | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
CREATE TRIGGER tr_SilinenVeli ON Veli | ||
AFTER DELETE | ||
AS | ||
BEGIN | ||
DECLARE @VeliTC varchar(11) | ||
DECLARE @Ad varchar(20) | ||
DECLARE @Soyad varchar(20) | ||
DECLARE @Kullanici_Adi varchar(30) | ||
DECLARE @Sifre varchar(20) | ||
DECLARE @Adres varchar(150) | ||
|
||
SELECT @VeliTC=VeliTC FROM deleted | ||
SELECT @Ad=Ad FROM deleted | ||
SELECT @Soyad=Soyad FROM deleted | ||
SELECT @Kullanici_Adi=Kullanici_Adi FROM deleted | ||
SELECT @Sifre=Sifre FROM deleted | ||
SELECT @Adres=Adres FROM deleted | ||
|
||
INSERT INTO SilinenVeli VALUES (@VeliTC,@Ad,@Soyad,@Kullanici_Adi,@Sifre,@Adres) | ||
|
||
END | ||
|
||
--ALTER TABLE Veli enable trigger tr_SilinenVeli | ||
|