SlideShare a Scribd company logo
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 FLOW3
Karsten 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
 
[ 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
Mikstura.IT Foundation | Web & Mobile Community
 
[ 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
Mikstura.IT Foundation | Web & Mobile Community
 
Clean code
Clean codeClean code
Clean code
iamAnaCortes
 
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
Red 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 #2
Hiroshi Shibamura
 
Lenses
LensesLenses
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 Group
kchodorow
 
Webtechnology lab
Webtechnology labWebtechnology lab
Webtechnology lab
Abirami Thangavel
 
Cleaner, Leaner, Meaner: Refactoring your jQuery
Cleaner, Leaner, Meaner: Refactoring your jQueryCleaner, Leaner, Meaner: Refactoring your jQuery
Cleaner, Leaner, Meaner: Refactoring your jQuery
Rebecca Murphey
 
MongoDB
MongoDBMongoDB
MongoDB
Steve Klabnik
 
Capstone Website Code
Capstone Website CodeCapstone Website Code
Capstone Website Code
Anthony Rimoldi
 
php plus mysql
php plus mysqlphp plus mysql
php plus mysql
Jayson de Leon
 
Xarxes socials
Xarxes socialsXarxes socials
Xarxes socials
Meri Caballero
 
Building Your First Widget
Building Your First WidgetBuilding Your First Widget
Building Your First Widget
Chris 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 Twilight
Donny 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 scripts

Bd venta.sql
Bd venta.sqlBd venta.sql
Codigo Server Festival
Codigo Server  FestivalCodigo Server  Festival
Codigo Server Festival
UNIVERSIDAD VERACRUZANA
 
DNN Database Tips & Tricks
DNN Database Tips & TricksDNN Database Tips & Tricks
DNN Database Tips & Tricks
Will Strohl
 
Procedures
ProceduresProcedures
Procedures
Luther Quinn
 
Implementation Specifications
Implementation SpecificationsImplementation Specifications
Implementation Specifications
Unmon Mukherjee
 
SQL Server 2008 Portfolio
SQL Server 2008 PortfolioSQL Server 2008 Portfolio
SQL Server 2008 Portfolio
lilredlokita
 
Sql
SqlSql
Sql
Joao
 
Greg Lewis SQL Portfolio
Greg Lewis SQL PortfolioGreg Lewis SQL Portfolio
Greg Lewis SQL Portfolio
gregmlewis
 
Permissions script for SQL Permissions
Permissions script for SQL PermissionsPermissions script for SQL Permissions
Permissions script for SQL Permissions
Tobias 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.pdf
irshadkumar3
 
FMDB - SLC-Cocoaheads
FMDB - SLC-CocoaheadsFMDB - SLC-Cocoaheads
FMDB - SLC-Cocoaheads
Dave Stevenson
 
Introducción rápida a SQL
Introducción rápida a SQLIntroducción rápida a SQL
Introducción rápida a SQL
Carlos 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 data
Ritesh Agrawal
 
Functions
FunctionsFunctions
Functions
Luther Quinn
 
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
Diponkar 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 table
Mahabubur Rahaman
 
Date dimension table - part II
Date dimension table - part IIDate dimension table - part II
Date dimension table - part II
Dirk Cludts
 
SQL-MySQL-Commands-Basic.pptx
SQL-MySQL-Commands-Basic.pptxSQL-MySQL-Commands-Basic.pptx
SQL-MySQL-Commands-Basic.pptx
Karthikeyan Muthukrishnan
 
Pdxpugday2010 pg90
Pdxpugday2010 pg90Pdxpugday2010 pg90
Pdxpugday2010 pg90
Selena Deckelmann
 
Azure sql insert perf
Azure sql insert perfAzure sql insert perf
Azure sql insert perf
Mornè Blake
 

Similar to Database scripts (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

一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
nuttdpt
 
DSSML24_tspann_CodelessGenerativeAIPipelines
DSSML24_tspann_CodelessGenerativeAIPipelinesDSSML24_tspann_CodelessGenerativeAIPipelines
DSSML24_tspann_CodelessGenerativeAIPipelines
Timothy Spann
 
Experts live - Improving user adoption with AI
Experts live - Improving user adoption with AIExperts live - Improving user adoption with AI
Experts live - Improving user adoption with AI
jitskeb
 
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
ytypuem
 
writing report business partner b1+ .pdf
writing report business partner b1+ .pdfwriting report business partner b1+ .pdf
writing report business partner b1+ .pdf
VyNguyen709676
 
Building a Quantum Computer Neutral Atom.pdf
Building a Quantum Computer Neutral Atom.pdfBuilding a Quantum Computer Neutral Atom.pdf
Building a Quantum Computer Neutral Atom.pdf
cjimenez2581
 
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docxDATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
SaffaIbrahim1
 
一比一原版(harvard毕业证书)哈佛大学毕业证如何办理
一比一原版(harvard毕业证书)哈佛大学毕业证如何办理一比一原版(harvard毕业证书)哈佛大学毕业证如何办理
一比一原版(harvard毕业证书)哈佛大学毕业证如何办理
taqyea
 
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
Timothy Spann
 
[VCOSA] Monthly Report - Cotton & Yarn Statistics March 2024
[VCOSA] Monthly Report - Cotton & Yarn Statistics March 2024[VCOSA] Monthly Report - Cotton & Yarn Statistics March 2024
[VCOSA] Monthly Report - Cotton & Yarn Statistics March 2024
Vietnam Cotton & Spinning Association
 
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
v7oacc3l
 
End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024
Lars Albertsson
 
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
xclpvhuk
 
Build applications with generative AI on Google Cloud
Build applications with generative AI on Google CloudBuild applications with generative AI on Google Cloud
Build applications with generative AI on Google Cloud
Márton Kodok
 
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging DataPredictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
Kiwi Creative
 
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
nyvan3
 
原版一比一多伦多大学毕业证(UofT毕业证书)如何办理
原版一比一多伦多大学毕业证(UofT毕业证书)如何办理原版一比一多伦多大学毕业证(UofT毕业证书)如何办理
原版一比一多伦多大学毕业证(UofT毕业证书)如何办理
mkkikqvo
 
一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理
aqzctr7x
 
一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理
一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理
一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理
hyfjgavov
 
A presentation that explain the Power BI Licensing
A presentation that explain the Power BI LicensingA presentation that explain the Power BI Licensing
A presentation that explain the Power BI Licensing
AlessioFois2
 

Recently uploaded (20)

一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
 
DSSML24_tspann_CodelessGenerativeAIPipelines
DSSML24_tspann_CodelessGenerativeAIPipelinesDSSML24_tspann_CodelessGenerativeAIPipelines
DSSML24_tspann_CodelessGenerativeAIPipelines
 
Experts live - Improving user adoption with AI
Experts live - Improving user adoption with AIExperts live - Improving user adoption with AI
Experts live - Improving user adoption with AI
 
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
 
writing report business partner b1+ .pdf
writing report business partner b1+ .pdfwriting report business partner b1+ .pdf
writing report business partner b1+ .pdf
 
Building a Quantum Computer Neutral Atom.pdf
Building a Quantum Computer Neutral Atom.pdfBuilding a Quantum Computer Neutral Atom.pdf
Building a Quantum Computer Neutral Atom.pdf
 
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docxDATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
 
一比一原版(harvard毕业证书)哈佛大学毕业证如何办理
一比一原版(harvard毕业证书)哈佛大学毕业证如何办理一比一原版(harvard毕业证书)哈佛大学毕业证如何办理
一比一原版(harvard毕业证书)哈佛大学毕业证如何办理
 
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
 
[VCOSA] Monthly Report - Cotton & Yarn Statistics March 2024
[VCOSA] Monthly Report - Cotton & Yarn Statistics March 2024[VCOSA] Monthly Report - Cotton & Yarn Statistics March 2024
[VCOSA] Monthly Report - Cotton & Yarn Statistics March 2024
 
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
 
End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024
 
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
 
Build applications with generative AI on Google Cloud
Build applications with generative AI on Google CloudBuild applications with generative AI on Google Cloud
Build applications with generative AI on Google Cloud
 
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging DataPredictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
 
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
 
原版一比一多伦多大学毕业证(UofT毕业证书)如何办理
原版一比一多伦多大学毕业证(UofT毕业证书)如何办理原版一比一多伦多大学毕业证(UofT毕业证书)如何办理
原版一比一多伦多大学毕业证(UofT毕业证书)如何办理
 
一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理
 
一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理
一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理
一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理
 
A presentation that explain the Power BI Licensing
A presentation that explain the Power BI LicensingA presentation that explain the Power BI Licensing
A presentation that explain the Power BI Licensing
 

Database scripts

  • 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… :)