SlideShare a Scribd company logo
1 of 10
Cüneyt Hocam Merhabalar…
Sunum bitiminde sorduğumda sanırsam veritabanı kodlarını da istemiştiniz,
emin değilim. Ayrıca, onları rapora ilave etmek istemedik; çünkü
raporu gereksiz şişireceğini düşündük ve o yüzden burada paylaştık.
Umarım beğenirsiniz.
SE [library]
GO
/****** Object: Table [dbo].[sex] Script Date: 05/19/2014 20:04:52 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[sex](
[Id] [int] IDENTITY(1,1) NOT NULL,
[sex] [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) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[city] Script Date: 05/19/2014 20:04:52 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[city](
[cityID] [int] IDENTITY(1,1) NOT NULL,
[CityName] [nchar](10) NULL,
CONSTRAINT [PK_city] PRIMARY KEY CLUSTERED
(
[cityID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF,
IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[Category] Script Date: 05/19/2014 20:04:52
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Category](
[CategoryId] [int] IDENTITY(1,1) NOT NULL,
[CategoryName] [nvarchar](50) NULL,
CONSTRAINT [PK_Category] PRIMARY KEY CLUSTERED
(
[CategoryId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF,
IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[Author] Script Date: 05/19/2014 20:04:52
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Author](
[AuthorId] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](50) NOT NULL,
[LastName] [nvarchar](50) NOT NULL,
CONSTRAINT [PK_Author] PRIMARY KEY CLUSTERED
(
[AuthorId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF,
IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[Status] Script Date: 05/19/2014 20:04:52
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Status](
[statuID] [int] IDENTITY(1,1) NOT NULL,
[Status] [nvarchar](50) NULL,
CONSTRAINT [PK_Status] PRIMARY KEY CLUSTERED
(
[statuID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF,
IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[Book] Script Date: 05/19/2014 20:04:52
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Book](
[BookId] [int] IDENTITY(1,1) NOT NULL,
[Title] [nvarchar](250) NULL,
[ISBN] [nvarchar](50) NULL,
[PublishDate] [date] NULL,
[StatusId] [int] NULL,
[CategoryId] [int] NULL,
[Place] [nvarchar](250) NULL,
[PlaceInLibrary] [nvarchar](50) NULL,
[Date] [date] NULL,
[Photo] [nvarchar](50) NULL,
CONSTRAINT [PK_Book] PRIMARY KEY CLUSTERED
(
[BookId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF,
IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[Address] Script Date: 05/19/2014 20:04:52
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Address](
[AddressId] [int] IDENTITY(1,1) NOT NULL,
[Adress] [nvarchar](250) NULL,
[CityId] [int] NULL,
CONSTRAINT [PK_Address] PRIMARY KEY CLUSTERED
(
[AddressId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF,
IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[book_Author] Script Date: 05/19/2014
20:04:52 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[book_Author](
[id] [int] IDENTITY(1,1) NOT NULL,
[bookId] [int] NULL,
[authorId] [int] NULL,
CONSTRAINT [PK_book_Author] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF,
IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: StoredProcedure [dbo].[sp_City] Script Date: 05/19/2014
20:04:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[sp_City]
as begin
select l.adress,s.cityName from Address l
inner join city s on l.cityId=s.cityID
end
GO
/****** Object: Table [dbo].[Users] Script Date: 05/19/2014 20:04:52
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Users](
[UserId] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](50) NULL,
[LastName] [nvarchar](50) NULL,
[SexId] [int] NULL,
[Phone] [nvarchar](50) NULL,
[Email] [nvarchar](50) NULL,
[Tc] [nvarchar](50) NULL,
[AddressId] [int] NULL,
CONSTRAINT [PK_User] PRIMARY KEY CLUSTERED
(
[UserId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF,
IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: StoredProcedure [dbo].[sp_User] Script Date: 05/19/2014
20:04:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[sp_User]
as begin
select u.Name,u.LastName,u.Email,u.Phone,a.Adress,c.CityName,s.sex
from Users u
inner join sex s on s.Id=u.SexId
inner join Address a on a.AddressId=u.AddressId
inner join city c on c.cityID=a.CityId
end
GO
/****** Object: StoredProcedure [dbo].[sp_Sex] Script Date: 05/19/2014
20:04:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[sp_Sex]
as begin
select l.name,l.LastName,s.Sex,l.Email from users l
inner join sex s on l.sexId=s.Id
end
GO
/****** Object: Table [dbo].[TBorrow] Script Date: 05/19/2014 20:04:52
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TBorrow](
[BorrowId] [int] IDENTITY(1,1) NOT NULL,
[UserId] [int] NULL,
[BookId] [int] NULL,
[BorrowDate] [nvarchar](50) NULL,
[ReturnDate] [nvarchar](50) NULL,
CONSTRAINT [PK_brrow] PRIMARY KEY CLUSTERED
(
[BorrowId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF,
IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: View [dbo].[vw_sp_book_Author] Script Date: 05/19/2014
20:04:52 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create view [dbo].[vw_sp_book_Author]
as
select
b.BookId,b.Title,a.Name,a.LastName,b.ISBN,b.PublishDate,s.Status,c.Catego
ryName,b.Place,b.PlaceInLibrary,b.Date,b.Photo from book_author ba
inner join Book b on b.BookId=ba.bookId
inner join Author a on a.AuthorId=ba.authorId
inner join Status s on s.statuID=b.StatusId
inner join Category c on c.CategoryId=b.CategoryId
GO
/****** Object: StoredProcedure [dbo].[sp_book_Author] Script Date:
05/19/2014 20:04:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[sp_book_Author]
as begin
select
b.BookId,b.Title,a.Name,a.LastName,b.ISBN,b.PublishDate,s.Status,c.Catego
ryName,b.Place,b.PlaceInLibrary,b.Date,b.Photo from book_author ba
inner join Book b on b.BookId=ba.bookId
inner join Author a on a.AuthorId=ba.authorId
inner join Status s on s.statuID=b.StatusId
inner join Category c on c.CategoryId=b.CategoryId
end
GO
/****** Object: StoredProcedure [dbo].[sp_Borrow] Script Date:
05/19/2014 20:04:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[sp_Borrow]
as begin
select b.borrowId,b.UserId,bk.Title,s.Status,b.borrowdate,b.returndate from
TBorrow b
inner join Book bk on bk.BookId=b.BookId
inner join Status s on s.statuID=bk.StatusId
end
GO
/****** Object: ForeignKey [FK_Address_Address] Script Date:
05/19/2014 20:04:52 ******/
ALTER TABLE [dbo].[Address] WITH CHECK ADD CONSTRAINT
[FK_Address_Address] FOREIGN KEY([AddressId])
REFERENCES [dbo].[Address] ([AddressId])
GO
ALTER TABLE [dbo].[Address] CHECK CONSTRAINT [FK_Address_Address]
GO
/****** Object: ForeignKey [FK_Address_city] Script Date: 05/19/2014
20:04:52 ******/
ALTER TABLE [dbo].[Address] WITH CHECK ADD CONSTRAINT
[FK_Address_city] FOREIGN KEY([CityId])
REFERENCES [dbo].[city] ([cityID])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[Address] CHECK CONSTRAINT [FK_Address_city]
GO
/****** Object: ForeignKey [FK_Book_Category] Script Date: 05/19/2014
20:04:52 ******/
ALTER TABLE [dbo].[Book] WITH CHECK ADD CONSTRAINT
[FK_Book_Category] FOREIGN KEY([CategoryId])
REFERENCES [dbo].[Category] ([CategoryId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[Book] CHECK CONSTRAINT [FK_Book_Category]
GO
/****** Object: ForeignKey [FK_Book_Status] Script Date: 05/19/2014
20:04:52 ******/
ALTER TABLE [dbo].[Book] WITH CHECK ADD CONSTRAINT
[FK_Book_Status] FOREIGN KEY([StatusId])
REFERENCES [dbo].[Status] ([statuID])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[Book] CHECK CONSTRAINT [FK_Book_Status]
GO
/****** Object: ForeignKey [FK_book_Author_Author] Script Date:
05/19/2014 20:04:52 ******/
ALTER TABLE [dbo].[book_Author] WITH CHECK ADD CONSTRAINT
[FK_book_Author_Author] FOREIGN KEY([authorId])
REFERENCES [dbo].[Author] ([AuthorId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[book_Author] CHECK CONSTRAINT
[FK_book_Author_Author]
GO
/****** Object: ForeignKey [FK_book_Author_Book] Script Date:
05/19/2014 20:04:52 ******/
ALTER TABLE [dbo].[book_Author] WITH CHECK ADD CONSTRAINT
[FK_book_Author_Book] FOREIGN KEY([bookId])
REFERENCES [dbo].[Book] ([BookId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[book_Author] CHECK CONSTRAINT
[FK_book_Author_Book]
GO
/****** Object: ForeignKey [FK_brrow_Book] Script Date: 05/19/2014
20:04:52 ******/
ALTER TABLE [dbo].[TBorrow] WITH NOCHECK ADD CONSTRAINT
[FK_brrow_Book] FOREIGN KEY([BookId])
REFERENCES [dbo].[Book] ([BookId])
GO
ALTER TABLE [dbo].[TBorrow] CHECK CONSTRAINT [FK_brrow_Book]
GO
/****** Object: ForeignKey [FK_brrow_Users] Script Date: 05/19/2014
20:04:52 ******/
ALTER TABLE [dbo].[TBorrow] WITH CHECK ADD CONSTRAINT
[FK_brrow_Users] FOREIGN KEY([UserId])
REFERENCES [dbo].[Users] ([UserId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[TBorrow] CHECK CONSTRAINT [FK_brrow_Users]
GO
/****** Object: ForeignKey [FK_Users_Address] Script Date: 05/19/2014
20:04:52 ******/
ALTER TABLE [dbo].[Users] WITH CHECK ADD CONSTRAINT
[FK_Users_Address] FOREIGN KEY([AddressId])
REFERENCES [dbo].[Address] ([AddressId])
GO
ALTER TABLE [dbo].[Users] CHECK CONSTRAINT [FK_Users_Address]
GO
THAT’S THE END OF THE DOCUMENT. GO AND GET SOME
BEVERAGE… :)

More Related Content

What's hot

Transparent Object Persistence with FLOW3
Transparent Object Persistence with FLOW3Transparent Object Persistence with FLOW3
Transparent Object Persistence with FLOW3Karsten Dambekalns
 
How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF Luc Bors
 
The Age of Slacktivism Motivating the Masses
The Age of Slacktivism Motivating the MassesThe Age of Slacktivism Motivating the Masses
The Age of Slacktivism Motivating the MassesRed Shoes PR
 
Introduction to DBIx::Lite - Kyoto.pm tech talk #2
Introduction to DBIx::Lite - Kyoto.pm tech talk #2Introduction to DBIx::Lite - Kyoto.pm tech talk #2
Introduction to DBIx::Lite - Kyoto.pm tech talk #2Hiroshi Shibamura
 
How else can you write the code in PHP?
How else can you write the code in PHP?How else can you write the code in PHP?
How else can you write the code in PHP?Maksym Hopei
 
Drush. Secrets come out.
Drush. Secrets come out.Drush. Secrets come out.
Drush. Secrets come out.Alex S
 
Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB jhchabran
 
San Francisco Java User Group
San Francisco Java User GroupSan Francisco Java User Group
San Francisco Java User Groupkchodorow
 
Cleaner, Leaner, Meaner: Refactoring your jQuery
Cleaner, Leaner, Meaner: Refactoring your jQueryCleaner, Leaner, Meaner: Refactoring your jQuery
Cleaner, Leaner, Meaner: Refactoring your jQueryRebecca Murphey
 
Building Your First Widget
Building Your First WidgetBuilding Your First Widget
Building Your First WidgetChris Wilcoxson
 
JSON and Swift, Still A Better Love Story Than Twilight
JSON and Swift, Still A Better Love Story Than TwilightJSON and Swift, Still A Better Love Story Than Twilight
JSON and Swift, Still A Better Love Story Than TwilightDonny Wals
 

What's hot (20)

Transparent Object Persistence with FLOW3
Transparent Object Persistence with FLOW3Transparent Object Persistence with FLOW3
Transparent Object Persistence with FLOW3
 
How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF
 
[ HackFest.pl 2012] Testing - what for and how
[ HackFest.pl 2012] Testing - what for and how[ HackFest.pl 2012] Testing - what for and how
[ HackFest.pl 2012] Testing - what for and how
 
[ WrocLoveRb 2012] user perspective testing using ruby
[ WrocLoveRb 2012] user perspective testing using ruby[ WrocLoveRb 2012] user perspective testing using ruby
[ WrocLoveRb 2012] user perspective testing using ruby
 
Clean code
Clean codeClean code
Clean code
 
The Age of Slacktivism Motivating the Masses
The Age of Slacktivism Motivating the MassesThe Age of Slacktivism Motivating the Masses
The Age of Slacktivism Motivating the Masses
 
Introduction to DBIx::Lite - Kyoto.pm tech talk #2
Introduction to DBIx::Lite - Kyoto.pm tech talk #2Introduction to DBIx::Lite - Kyoto.pm tech talk #2
Introduction to DBIx::Lite - Kyoto.pm tech talk #2
 
Lenses
LensesLenses
Lenses
 
How else can you write the code in PHP?
How else can you write the code in PHP?How else can you write the code in PHP?
How else can you write the code in PHP?
 
Drush. Secrets come out.
Drush. Secrets come out.Drush. Secrets come out.
Drush. Secrets come out.
 
Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB
 
San Francisco Java User Group
San Francisco Java User GroupSan Francisco Java User Group
San Francisco Java User Group
 
Webtechnology lab
Webtechnology labWebtechnology lab
Webtechnology lab
 
Cleaner, Leaner, Meaner: Refactoring your jQuery
Cleaner, Leaner, Meaner: Refactoring your jQueryCleaner, Leaner, Meaner: Refactoring your jQuery
Cleaner, Leaner, Meaner: Refactoring your jQuery
 
MongoDB
MongoDBMongoDB
MongoDB
 
Capstone Website Code
Capstone Website CodeCapstone Website Code
Capstone Website Code
 
php plus mysql
php plus mysqlphp plus mysql
php plus mysql
 
Xarxes socials
Xarxes socialsXarxes socials
Xarxes socials
 
Building Your First Widget
Building Your First WidgetBuilding Your First Widget
Building Your First Widget
 
JSON and Swift, Still A Better Love Story Than Twilight
JSON and Swift, Still A Better Love Story Than TwilightJSON and Swift, Still A Better Love Story Than Twilight
JSON and Swift, Still A Better Love Story Than Twilight
 

Similar to Database tables and stored procedures

DNN Database Tips & Tricks
DNN Database Tips & TricksDNN Database Tips & Tricks
DNN Database Tips & TricksWill Strohl
 
Implementation Specifications
Implementation SpecificationsImplementation Specifications
Implementation SpecificationsUnmon Mukherjee
 
SQL Server 2008 Portfolio
SQL Server 2008 PortfolioSQL Server 2008 Portfolio
SQL Server 2008 Portfoliolilredlokita
 
Sql
SqlSql
SqlJoao
 
Greg Lewis SQL Portfolio
Greg Lewis SQL PortfolioGreg Lewis SQL Portfolio
Greg Lewis SQL Portfoliogregmlewis
 
Permissions script for SQL Permissions
Permissions script for SQL PermissionsPermissions script for SQL Permissions
Permissions script for SQL PermissionsTobias Koprowski
 
I am getting an errormsg 911, Level 16, State 1, Line 12 Database.pdf
I am getting an errormsg 911, Level 16, State 1, Line 12 Database.pdfI am getting an errormsg 911, Level 16, State 1, Line 12 Database.pdf
I am getting an errormsg 911, Level 16, State 1, Line 12 Database.pdfirshadkumar3
 
Introducción rápida a SQL
Introducción rápida a SQLIntroducción rápida a SQL
Introducción rápida a SQLCarlos Hernando
 
Simple Strategies for faster knowledge discovery in big data
Simple Strategies for faster knowledge discovery in big dataSimple Strategies for faster knowledge discovery in big data
Simple Strategies for faster knowledge discovery in big dataRitesh Agrawal
 
Sql vs no sql diponkar paul-april 2020-Toronto PASS
Sql vs no sql   diponkar paul-april 2020-Toronto PASSSql vs no sql   diponkar paul-april 2020-Toronto PASS
Sql vs no sql diponkar paul-april 2020-Toronto PASSDiponkar Paul
 
supporting t-sql scripts for Heap vs clustered table
supporting t-sql scripts for Heap vs clustered tablesupporting t-sql scripts for Heap vs clustered table
supporting t-sql scripts for Heap vs clustered tableMahabubur Rahaman
 
Date dimension table - part II
Date dimension table - part IIDate dimension table - part II
Date dimension table - part IIDirk Cludts
 
Azure sql insert perf
Azure sql insert perfAzure sql insert perf
Azure sql insert perfMornè Blake
 

Similar to Database tables and stored procedures (20)

Bd venta.sql
Bd venta.sqlBd venta.sql
Bd venta.sql
 
Codigo Server Festival
Codigo Server  FestivalCodigo Server  Festival
Codigo Server Festival
 
DNN Database Tips & Tricks
DNN Database Tips & TricksDNN Database Tips & Tricks
DNN Database Tips & Tricks
 
Procedures
ProceduresProcedures
Procedures
 
Implementation Specifications
Implementation SpecificationsImplementation Specifications
Implementation Specifications
 
SQL Server 2008 Portfolio
SQL Server 2008 PortfolioSQL Server 2008 Portfolio
SQL Server 2008 Portfolio
 
Sql
SqlSql
Sql
 
Greg Lewis SQL Portfolio
Greg Lewis SQL PortfolioGreg Lewis SQL Portfolio
Greg Lewis SQL Portfolio
 
Permissions script for SQL Permissions
Permissions script for SQL PermissionsPermissions script for SQL Permissions
Permissions script for SQL Permissions
 
I am getting an errormsg 911, Level 16, State 1, Line 12 Database.pdf
I am getting an errormsg 911, Level 16, State 1, Line 12 Database.pdfI am getting an errormsg 911, Level 16, State 1, Line 12 Database.pdf
I am getting an errormsg 911, Level 16, State 1, Line 12 Database.pdf
 
FMDB - SLC-Cocoaheads
FMDB - SLC-CocoaheadsFMDB - SLC-Cocoaheads
FMDB - SLC-Cocoaheads
 
Introducción rápida a SQL
Introducción rápida a SQLIntroducción rápida a SQL
Introducción rápida a SQL
 
Simple Strategies for faster knowledge discovery in big data
Simple Strategies for faster knowledge discovery in big dataSimple Strategies for faster knowledge discovery in big data
Simple Strategies for faster knowledge discovery in big data
 
Functions
FunctionsFunctions
Functions
 
Sql vs no sql diponkar paul-april 2020-Toronto PASS
Sql vs no sql   diponkar paul-april 2020-Toronto PASSSql vs no sql   diponkar paul-april 2020-Toronto PASS
Sql vs no sql diponkar paul-april 2020-Toronto PASS
 
supporting t-sql scripts for Heap vs clustered table
supporting t-sql scripts for Heap vs clustered tablesupporting t-sql scripts for Heap vs clustered table
supporting t-sql scripts for Heap vs clustered table
 
Date dimension table - part II
Date dimension table - part IIDate dimension table - part II
Date dimension table - part II
 
SQL-MySQL-Commands-Basic.pptx
SQL-MySQL-Commands-Basic.pptxSQL-MySQL-Commands-Basic.pptx
SQL-MySQL-Commands-Basic.pptx
 
Pdxpugday2010 pg90
Pdxpugday2010 pg90Pdxpugday2010 pg90
Pdxpugday2010 pg90
 
Azure sql insert perf
Azure sql insert perfAzure sql insert perf
Azure sql insert perf
 

Recently uploaded

Unveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystUnveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystSamantha Rae Coolbeth
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% SecurePooja Nehwal
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptxAnupama Kate
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfMarinCaroMartnezBerg
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz1
 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...Suhani Kapoor
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxolyaivanovalion
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxolyaivanovalion
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfLars Albertsson
 
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一ffjhghh
 
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...Suhani Kapoor
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfLars Albertsson
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxolyaivanovalion
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxolyaivanovalion
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxfirstjob4
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 

Recently uploaded (20)

Unveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystUnveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data Analyst
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
 
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx
 
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdf
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptx
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptx
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdf
 
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一
 
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdf
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptx
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptx
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptx
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Sampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptSampling (random) method and Non random.ppt
Sampling (random) method and Non random.ppt
 

Database tables and stored procedures

  • 1. Cüneyt Hocam Merhabalar… Sunum bitiminde sorduğumda sanırsam veritabanı kodlarını da istemiştiniz, emin değilim. Ayrıca, onları rapora ilave etmek istemedik; çünkü raporu gereksiz şişireceğini düşündük ve o yüzden burada paylaştık. Umarım beğenirsiniz. SE [library] GO /****** Object: Table [dbo].[sex] Script Date: 05/19/2014 20:04:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[sex]( [Id] [int] IDENTITY(1,1) NOT NULL, [sex] [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) ON [PRIMARY] ) ON [PRIMARY] GO /****** Object: Table [dbo].[city] Script Date: 05/19/2014 20:04:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[city]( [cityID] [int] IDENTITY(1,1) NOT NULL, [CityName] [nchar](10) NULL, CONSTRAINT [PK_city] PRIMARY KEY CLUSTERED ( [cityID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY]
  • 2. GO /****** Object: Table [dbo].[Category] Script Date: 05/19/2014 20:04:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[Category]( [CategoryId] [int] IDENTITY(1,1) NOT NULL, [CategoryName] [nvarchar](50) NULL, CONSTRAINT [PK_Category] PRIMARY KEY CLUSTERED ( [CategoryId] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO /****** Object: Table [dbo].[Author] Script Date: 05/19/2014 20:04:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[Author]( [AuthorId] [int] IDENTITY(1,1) NOT NULL, [Name] [nvarchar](50) NOT NULL, [LastName] [nvarchar](50) NOT NULL, CONSTRAINT [PK_Author] PRIMARY KEY CLUSTERED ( [AuthorId] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO /****** Object: Table [dbo].[Status] Script Date: 05/19/2014 20:04:52 ******/
  • 3. SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[Status]( [statuID] [int] IDENTITY(1,1) NOT NULL, [Status] [nvarchar](50) NULL, CONSTRAINT [PK_Status] PRIMARY KEY CLUSTERED ( [statuID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO /****** Object: Table [dbo].[Book] Script Date: 05/19/2014 20:04:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[Book]( [BookId] [int] IDENTITY(1,1) NOT NULL, [Title] [nvarchar](250) NULL, [ISBN] [nvarchar](50) NULL, [PublishDate] [date] NULL, [StatusId] [int] NULL, [CategoryId] [int] NULL, [Place] [nvarchar](250) NULL, [PlaceInLibrary] [nvarchar](50) NULL, [Date] [date] NULL, [Photo] [nvarchar](50) NULL, CONSTRAINT [PK_Book] PRIMARY KEY CLUSTERED ( [BookId] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO /****** Object: Table [dbo].[Address] Script Date: 05/19/2014 20:04:52
  • 4. ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[Address]( [AddressId] [int] IDENTITY(1,1) NOT NULL, [Adress] [nvarchar](250) NULL, [CityId] [int] NULL, CONSTRAINT [PK_Address] PRIMARY KEY CLUSTERED ( [AddressId] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO /****** Object: Table [dbo].[book_Author] Script Date: 05/19/2014 20:04:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[book_Author]( [id] [int] IDENTITY(1,1) NOT NULL, [bookId] [int] NULL, [authorId] [int] NULL, CONSTRAINT [PK_book_Author] PRIMARY KEY CLUSTERED ( [id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO /****** Object: StoredProcedure [dbo].[sp_City] Script Date: 05/19/2014 20:04:50 ******/ SET ANSI_NULLS ON GO
  • 5. SET QUOTED_IDENTIFIER ON GO create proc [dbo].[sp_City] as begin select l.adress,s.cityName from Address l inner join city s on l.cityId=s.cityID end GO /****** Object: Table [dbo].[Users] Script Date: 05/19/2014 20:04:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[Users]( [UserId] [int] IDENTITY(1,1) NOT NULL, [Name] [nvarchar](50) NULL, [LastName] [nvarchar](50) NULL, [SexId] [int] NULL, [Phone] [nvarchar](50) NULL, [Email] [nvarchar](50) NULL, [Tc] [nvarchar](50) NULL, [AddressId] [int] NULL, CONSTRAINT [PK_User] PRIMARY KEY CLUSTERED ( [UserId] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO /****** Object: StoredProcedure [dbo].[sp_User] Script Date: 05/19/2014 20:04:50 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE proc [dbo].[sp_User] as begin
  • 6. select u.Name,u.LastName,u.Email,u.Phone,a.Adress,c.CityName,s.sex from Users u inner join sex s on s.Id=u.SexId inner join Address a on a.AddressId=u.AddressId inner join city c on c.cityID=a.CityId end GO /****** Object: StoredProcedure [dbo].[sp_Sex] Script Date: 05/19/2014 20:04:50 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE proc [dbo].[sp_Sex] as begin select l.name,l.LastName,s.Sex,l.Email from users l inner join sex s on l.sexId=s.Id end GO /****** Object: Table [dbo].[TBorrow] Script Date: 05/19/2014 20:04:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[TBorrow]( [BorrowId] [int] IDENTITY(1,1) NOT NULL, [UserId] [int] NULL, [BookId] [int] NULL, [BorrowDate] [nvarchar](50) NULL, [ReturnDate] [nvarchar](50) NULL, CONSTRAINT [PK_brrow] PRIMARY KEY CLUSTERED ( [BorrowId] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY]
  • 7. GO /****** Object: View [dbo].[vw_sp_book_Author] Script Date: 05/19/2014 20:04:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create view [dbo].[vw_sp_book_Author] as select b.BookId,b.Title,a.Name,a.LastName,b.ISBN,b.PublishDate,s.Status,c.Catego ryName,b.Place,b.PlaceInLibrary,b.Date,b.Photo from book_author ba inner join Book b on b.BookId=ba.bookId inner join Author a on a.AuthorId=ba.authorId inner join Status s on s.statuID=b.StatusId inner join Category c on c.CategoryId=b.CategoryId GO /****** Object: StoredProcedure [dbo].[sp_book_Author] Script Date: 05/19/2014 20:04:50 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE proc [dbo].[sp_book_Author] as begin select b.BookId,b.Title,a.Name,a.LastName,b.ISBN,b.PublishDate,s.Status,c.Catego ryName,b.Place,b.PlaceInLibrary,b.Date,b.Photo from book_author ba inner join Book b on b.BookId=ba.bookId inner join Author a on a.AuthorId=ba.authorId inner join Status s on s.statuID=b.StatusId inner join Category c on c.CategoryId=b.CategoryId end GO /****** Object: StoredProcedure [dbo].[sp_Borrow] Script Date:
  • 8. 05/19/2014 20:04:50 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE proc [dbo].[sp_Borrow] as begin select b.borrowId,b.UserId,bk.Title,s.Status,b.borrowdate,b.returndate from TBorrow b inner join Book bk on bk.BookId=b.BookId inner join Status s on s.statuID=bk.StatusId end GO /****** Object: ForeignKey [FK_Address_Address] Script Date: 05/19/2014 20:04:52 ******/ ALTER TABLE [dbo].[Address] WITH CHECK ADD CONSTRAINT [FK_Address_Address] FOREIGN KEY([AddressId]) REFERENCES [dbo].[Address] ([AddressId]) GO ALTER TABLE [dbo].[Address] CHECK CONSTRAINT [FK_Address_Address] GO /****** Object: ForeignKey [FK_Address_city] Script Date: 05/19/2014 20:04:52 ******/ ALTER TABLE [dbo].[Address] WITH CHECK ADD CONSTRAINT [FK_Address_city] FOREIGN KEY([CityId]) REFERENCES [dbo].[city] ([cityID]) ON UPDATE CASCADE ON DELETE CASCADE GO ALTER TABLE [dbo].[Address] CHECK CONSTRAINT [FK_Address_city] GO /****** Object: ForeignKey [FK_Book_Category] Script Date: 05/19/2014 20:04:52 ******/ ALTER TABLE [dbo].[Book] WITH CHECK ADD CONSTRAINT [FK_Book_Category] FOREIGN KEY([CategoryId])
  • 9. REFERENCES [dbo].[Category] ([CategoryId]) ON UPDATE CASCADE ON DELETE CASCADE GO ALTER TABLE [dbo].[Book] CHECK CONSTRAINT [FK_Book_Category] GO /****** Object: ForeignKey [FK_Book_Status] Script Date: 05/19/2014 20:04:52 ******/ ALTER TABLE [dbo].[Book] WITH CHECK ADD CONSTRAINT [FK_Book_Status] FOREIGN KEY([StatusId]) REFERENCES [dbo].[Status] ([statuID]) ON UPDATE CASCADE ON DELETE CASCADE GO ALTER TABLE [dbo].[Book] CHECK CONSTRAINT [FK_Book_Status] GO /****** Object: ForeignKey [FK_book_Author_Author] Script Date: 05/19/2014 20:04:52 ******/ ALTER TABLE [dbo].[book_Author] WITH CHECK ADD CONSTRAINT [FK_book_Author_Author] FOREIGN KEY([authorId]) REFERENCES [dbo].[Author] ([AuthorId]) ON UPDATE CASCADE ON DELETE CASCADE GO ALTER TABLE [dbo].[book_Author] CHECK CONSTRAINT [FK_book_Author_Author] GO /****** Object: ForeignKey [FK_book_Author_Book] Script Date: 05/19/2014 20:04:52 ******/ ALTER TABLE [dbo].[book_Author] WITH CHECK ADD CONSTRAINT [FK_book_Author_Book] FOREIGN KEY([bookId]) REFERENCES [dbo].[Book] ([BookId]) ON UPDATE CASCADE ON DELETE CASCADE GO
  • 10. ALTER TABLE [dbo].[book_Author] CHECK CONSTRAINT [FK_book_Author_Book] GO /****** Object: ForeignKey [FK_brrow_Book] Script Date: 05/19/2014 20:04:52 ******/ ALTER TABLE [dbo].[TBorrow] WITH NOCHECK ADD CONSTRAINT [FK_brrow_Book] FOREIGN KEY([BookId]) REFERENCES [dbo].[Book] ([BookId]) GO ALTER TABLE [dbo].[TBorrow] CHECK CONSTRAINT [FK_brrow_Book] GO /****** Object: ForeignKey [FK_brrow_Users] Script Date: 05/19/2014 20:04:52 ******/ ALTER TABLE [dbo].[TBorrow] WITH CHECK ADD CONSTRAINT [FK_brrow_Users] FOREIGN KEY([UserId]) REFERENCES [dbo].[Users] ([UserId]) ON UPDATE CASCADE ON DELETE CASCADE GO ALTER TABLE [dbo].[TBorrow] CHECK CONSTRAINT [FK_brrow_Users] GO /****** Object: ForeignKey [FK_Users_Address] Script Date: 05/19/2014 20:04:52 ******/ ALTER TABLE [dbo].[Users] WITH CHECK ADD CONSTRAINT [FK_Users_Address] FOREIGN KEY([AddressId]) REFERENCES [dbo].[Address] ([AddressId]) GO ALTER TABLE [dbo].[Users] CHECK CONSTRAINT [FK_Users_Address] GO THAT’S THE END OF THE DOCUMENT. GO AND GET SOME BEVERAGE… :)