NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

create database gayrimenkuldatabase
go
Use gayrimenkuldatabase
go



CREATE TABLE AltTurler(
AltTurID int IDENTITY(1,1) PRIMARY KEY NOT NULL,
TurID int NULL,
AltTurAd nchar(20) NULL

)
go
CREATE TABLE Turler (
TurID int IDENTITY(1,1) PRIMARY KEY NOT NULL,
TurAdı nchar(20) NULL
)
GO
CREATE TABLE Kimden (
KimdenID int IDENTITY(1,1) PRIMARY KEY NOT NULL,
Kimden nchar(20) NULL
)
GO
CREATE TABLE FiyatTurler (
FiyatTurID int IDENTITY(1,1) PRIMARY KEY NOT NULL,
FiyatTur nchar(10) NOT NULL
)
GO

CREATE TABLE İslemler(
İslemID int IDENTITY(1,1) PRIMARY KEY NOT NULL,
İslem nchar(20) NULL
)
GO
CREATE TABLE İller(
SehirID int IDENTITY(1,1) PRIMARY KEY NOT NULL,
SehirAdı nvarchar(50) NULL,
)
GO
CREATE TABLE Ilceler(
IlceID int IDENTITY(1,1) PRIMARY KEY NOT NULL,
SehirID int NULL,
IlceAdı nchar(20) NULL,
Constraint FK_Ilceler_SehirID Foreign Key(SehirID) References İller(SehirID)
)
GO
CREATE TABLE Kullanicilar(
KullaniciID int IDENTITY(1,1) PRIMARY KEY NOT NULL,
Meslek nchar(20) NULL,
KullanıcıAd nchar(20) NULL,
Sifre nchar(20) NULL,
AdSoyad nchar(20) NULL,
EMail nchar(50) NULL,
Telefon nchar(20) NULL
)
GO


CREATE TABLE Ilanlar(
IlanID int IDENTITY(1,1) PRIMARY KEY NOT NULL,
TurID int NULL,
AltTurID int NULL,
IslemID int NULL,
FiyatTurID int NULL,
Fiyat money NULL,
KimdenID int NULL,
KullaniciID int NULL,
SehirID int NULL,
İlceID int NULL,
Acıklama nchar(100) NULL,
Tarih datetime NULL,
Constraint FK_Ilanlar_TurID Foreign Key(TurID) References Turler(TurID),
Constraint FK_Ilanlar_AltTurID Foreign Key(AltTurID) References AltTurler(AltTurID),
Constraint FK_Ilanlar_IslemID Foreign Key(IslemID) References İslemler(İslemID),
Constraint FK_Ilanlar_FiyatTurID Foreign Key(FiyatTurID) References FiyatTurler(FiyatTurID),
Constraint FK_Ilanlar_KimdenID Foreign Key(KimdenID) References Kimden(KimdenID),
Constraint FK_Ilanlar_TurID Foreign Key(TurID) References Turler(TurID),
Constraint FK_Ilanlar_SehirID Foreign Key(SehirID) References İller(SehirID),
Constraint FK_Ilanlar_İlceID Foreign Key(İlceID) References Ilceler(IlceID),
Constraint FK_İller_KullaniciID Foreign Key(KullaniciID) References Kullanicilar(KullaniciID)
)
GO
CREATE TABLE DısOzellikler(
DısOzellikID int IDENTITY(1,1) PRIMARY KEY NOT NULL,
DısOzellik nchar(35) NULL
)
GO

CREATE TABLE SeciliDisOzellikler(
SeciliDisOzelliklerID int IDENTITY(1,1) PRIMARY KEY NOT NULL,
IlanID int NULL,
DısOzellikID int NULL,

Constraint FK_SeciliDisOzelliklerr_DısOzellikID Foreign Key(DısOzellikID) References DısOzellikler(DısOzellikID)
)
go
CREATE TABLE Cephe(
CepheID int IDENTITY(1,1) PRIMARY KEY NOT NULL,
Cephe nchar(10) NULL

)
go

CREATE TABLE SeciliCephe(
SeciliCepheID int IDENTITY(1,1) PRIMARY KEY NOT NULL,
IlanID int NULL,
CepheID int NULL,
Constraint FK_SeciliCephe_CepheID Foreign Key(CepheID) References Cephe(CepheID)
)
GO
CREATE TABLE Muhit(
MuhitID int IDENTITY(1,1) PRIMARY KEY NOT NULL,
Muhit nchar(25) NULL
)
GO

CREATE TABLE SeciliMuhit(
SeciliMuhitID int IDENTITY(1,1) PRIMARY KEY NOT NULL,
IlanID int NULL,
MuhitID int NULL,
Constraint FK_SeciliMuhit_SeciliMuhitID Foreign Key(SeciliMuhitID) References Muhit(MuhitID)
)
GO

CREATE TABLE İcOzellikler(
IcOzelliklerID int IDENTITY(1,1) PRIMARY KEY NOT NULL,
IcOzellik nchar(40) NULL
)
GO
CREATE TABLE SeciliicOzellikler(
SeciliicOzelliklerID int IDENTITY(1,1) PRIMARY KEY NOT NULL,
IlanID int NULL,
IcOzelliklerID int NULL,

Constraint FK_SeciliicOzellikler_IcOzelliklerID Foreign Key(IcOzelliklerID) References İcOzellikler(IcOzelliklerID)
)
GO

CREATE TABLE Ulasim(
UlasimID int IDENTITY(1,1) PRIMARY KEY NOT NULL,
Ulasım nchar(300) NULL

)
go
CREATE TABLE SeciliUlasim(
SeciliUlasimID int IDENTITY(1,1) PRIMARY KEY NOT NULL,
IlanID int NULL,
UlasımID int NULL
Constraint FK_SeciliUlasim_SeciliUlasimID Foreign Key (SeciliUlasimID) References Ulasim(UlasimID)
)



create proc SP_InsertTurCesidi

(
@TurAdı nchar(20)
)
AS
BEGIN
INSERT INTO Turler (TurAdı)
values(@TurAdı)
end
exec SP_InsertTurCesidi 'Konut'
exec SP_InsertTurCesidi 'Arsa'

create proc SP_InsertAltTurCesidi
(
@AltTurAd nchar(20)
)
AS
BEGIN
INSERT INTO AltTurler (AltTurAd)
values(@AltTurAd)
end
exec SP_InsertAltTurCesidi 'Villa'
exec SP_InsertAltTurCesidi 'Apatman'


create proc SP_InsertFiyatAltTurCesidi
(
@FiyatTur nchar(20)
)
AS
BEGIN
INSERT INTO FiyatTurler (FiyatTur)
values(@FiyatTur)
end
exec SP_InsertTurCesidi 'Dolar'
exec SP_InsertTurCesidi 'Euro'

create proc SP_InsertKimden
(
@kimden nchar(20)
)
AS
BEGIN
INSERT INTO Kimden (Kimden)
values(@Kimden)
end
exec SP_InsertKimden 'Sahibinden'
exec SP_InsertKimden 'Emlaktan'

create proc SP_InsertİslemEkle
(
@İslem nchar(20)
)
AS
BEGIN
INSERT INTO İslemler (İslem)
values(@İslem)
end
exec SP_InsertİslemEkle 'Nakit'
exec SP_InsertİslemEkle 'Kredi'

create proc SP_InsertİlEkle
(
@SehirAdı nchar(20)

)
AS
BEGIN
INSERT INTO İller (SehirAdı)
values(@SehirAdı)
end
exec SP_InsertTurCesidi 'Istanbul'
exec SP_InsertTurCesidi 'Ordu'

create proc SP_InsertIlceEkle
(
@IlceAdı nchar(20)

)
AS
BEGIN
INSERT INTO Ilceler (IlceAdı)
values(@IlceAdı)
end
exec SP_InsertIlceEkle 'Besiktas'
exec SP_InsertIlceEkle 'Merter'

create proc SP_KullaniciYükle
(
@Meslek nchar(20) ,
@AdSoyad nchar(20) ,
@EMail nchar(50)

)
AS
BEGIN
INSERT INTO Kullanicilar (Meslek,AdSoyad,EMail)
values(@Meslek,@AdSoyad,@EMail)
end
exec SP_KullaniciYükle'Köle','ismailkaragündüz','hotmailcom'

create proc SP_InsertIlanEkle
(
@Fiyat money,
@Acıklama nchar(50)
)
AS
BEGIN
INSERT INTO Ilanlar(Fiyat,Acıklama)
values(@Fiyat,@Acıklama)
end
exec SP_InsertIlanEkle '150000','Buyuk EV'


--DELETE KISMI


create proc SP_Deleteİlcee

(
@IlceID INT
)
AS
BEGIN
DELETE FROM Ilceler
WHERE IlceID=@IlceID

END


exec SP_Deleteİlcee 1


--UPDATE


CREATE PROC SP_UpdateSehir
(
@IlceID INT,
@IlceAdı nchar(20)
)
AS
BEGIN
UPDATE Ilceler
SET IlceAdı=@IlceAdı
WHERE IlceID=@IlceID


END
exec SP_UpdateSehir 2,'Dikilitaş'

--VIEW

create view ViewAdres
as

select SehirAdı,IlceAdı
FROM İller INNER JOIN Ilceler
on İller.SehirID=Ilceler.IlceID

SELECT * from ViewAdres

--TRIGGER TETİK

CREATE TRIGGER YeniTur
ON Turler
AFTER INSERT
AS BEGIN
SELECT 'Yeni Tur Eklendi'
END
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.