SlideShare a Scribd company logo
1 of 10
SAMPLE DATABASE DESIGN
METHODOLOGY USING
MS SQL SERVER 2017
This is a sample Database Design Methodology using
MS SQL Server 2017 T-SQL scripts in which the following basic
concepts will be explained in a minimalistic but concise manner
for the DBA to understand:
1. Database Creation
2. Filegroups
3. Files
4. Tables
5. Indexes
6. Storage Considerations
Author: Wally M. Pons
E-mail: wpons@datagrupo.com
Twitter: @Datagrupo
Facebook: Datagrupo
Date Published: Sept-23-2018
Corrected/Revised on: N/A
DATABASE CREATION (1 OF 3)
 Normally (but not necessarily), MS SQL Server Databases are by default
created with two files, one is called the primary data and the other is the
transaction log. Additional files that you create are called secondary files and
can be created when needed or at any given moment in time.
 The main function of the primary data is to hold information about objects
within the database, here is a short list of the most common objects that may
be included in it:
1. Tables
2. Primary Keys
3. Indexes
4. Blobs
5. Stored Procedures
6. Triggers
7. Functions
8. Diagrams
9. Data Types
10. Defaults
11. Views
DATABASE CREATION (2 OF 3)
 On the previous list, the first four objects appear on bold letters, this indicates
that they specifically store the data you input on the database, therefore each
one of them requires a special handling involving a Filegroup and a
secondary data file for this purpose.
 The rest of the items listed can reside on the primary filegroup as they are
only stored as text and do not account on the total of records held on the
database.
 To put things in perspective, a few hundreds or even thousands of those
objects (5 to 11 from the list) may account for roughly 50 MB† of data. This is
an accurate number from real world data, nevertheless, if you feel that you
require more than 50 MB then you may increase it to your needs.
 † MB stands for Megabyte, it is the equivalent of 1,048,576 Bytes, a Byte can be also described as one character, this
includes spaces, special characters and punctuations marks too.
DATABASE CREATION (3 OF 3)
 The following T-SQL shows how to create a database, please note that you
must first create the folders manually and in convenience with your
environment, which could be different to the one shown below. Please feel
free to make any changes to the script to accommodate the aforementioned.
FILEGROUPS
 In order to have your secondary data files properly segmented, you must
create the necessary Filegroups that can hold them. Unlike a physical file, a
Filegroup is a logical structure which groups the files that compose your
database. On MS SQL Server you can create a total of 32,767 Filegroups per
database, just as the same number of physical files.
 In order to keep with the good documentation practice (GDocP), always use
standardization when creating object names, similar to the “Leszynski naming
convention”, it helps you and other people to better understand your design
methodologies. Below is the T-SQL code to create the Filegroups for a table
in our “DB_SAMPLE_2017” database:
 In this case the Filegroup name starts with “Fg”, then the type (Tbl=Table, PK=Primary
Key, Idx=Index, Blb=Blob / Binary data), name of the object and in cases other than
tables you must include the field name(s).
FILES
 Once we have our Filegroups defined we proceed to create the necessary
files and assign them accordingly. Quick note: Files are also called “Devices”
by some SQL developers.
 On the above T-SQL script we can see the most important details in the file creation
process from left to right:
1. NAME: (logical within SQL Server) Is the internal name of the file.
2. FILENAME: Is the physical name of the file including the extension.
3. SIZE: Is the initially physical size of the file, optionally we put a percentile growth but
it can also be specified on MB.
4. TO FILEGROUP: This is where we specify the name of the Filegroup to which the
file belongs.
TABLES
 The following T-SQL script shows a customers table with its filegroups,
defaults (constraints), data types, Primary Key and blob field. Please feel free
to make any changes to this script to accommodate it to your needs.
INDEXES
 The following T-SQL script shows an index by the “SSN” field, the purpose of
this is to enhance search and sorting by this field, also note that it is a NON
CLUSTERED index, which means it does not index other fields on the table, if
you require to perform the same operation by other fields you will need to
create the Filegroup + File for the new index along with the script. Please feel
free to make any changes to this script to accommodate it to your needs.
STORAGE CONSIDERATIONS
 Finally, the database has been created and you are tentatively ready to input
data, but before you do that you also need to know how much data space can
the table hold and what would be the storage cost in MB (or GB / TB) for your
disks, after all, you don’t want to run out of space. We execute the following
T-SQL using SSMS to view the required information:
 It takes 1,048,576 Bytes to complete a Megabyte, which means that by the
time you have around 3,826 records / rows of data you will also have taken
close to 1 MB of space from your physical disk.
THANKS / T-SQL SCRIPT DOWNLOAD LINK
 Thank you for taking the time on reading this sample database design
methodology guide, I hope it was helpful to your knowledge. Please feel free
to download a copy of the T-SQL that has been used here in, it is available
from my website in a text format on the following link:
https://datagrupo.com/db_sample_2017/Create_DB_SAMPLE_2017.txt
 You may also send me an email with any questions regarding this material,
which is included “As Is” and without warranty, that is unless I give you the file
in person, make a copy of it to your device and run it.
 Last but not least, please follow me on twitter and/or like my facebook page
for datagrupo.
Yours truly,
Wally M. Pons

More Related Content

What's hot

Google - Bigtable
Google - BigtableGoogle - Bigtable
Google - Bigtable영원 서
 
S3 l5 db2 - process model
S3 l5   db2 - process modelS3 l5   db2 - process model
S3 l5 db2 - process modelMohammad Khan
 
Physical architecture of sql server
Physical architecture of sql serverPhysical architecture of sql server
Physical architecture of sql serverDivya Sharma
 
Introducing ms sql_server_updated
Introducing ms sql_server_updatedIntroducing ms sql_server_updated
Introducing ms sql_server_updatedleetinhf
 
Exchange Server Recovery
Exchange Server RecoveryExchange Server Recovery
Exchange Server Recoverymartin09miller
 
NOSQL and MongoDB Database
NOSQL and MongoDB DatabaseNOSQL and MongoDB Database
NOSQL and MongoDB DatabaseTariqul islam
 
Randomizing Data With SQL Server
Randomizing Data With SQL ServerRandomizing Data With SQL Server
Randomizing Data With SQL ServerWally Pons
 
Bigtable: A Distributed Storage System for Structured Data
Bigtable: A Distributed Storage System for Structured DataBigtable: A Distributed Storage System for Structured Data
Bigtable: A Distributed Storage System for Structured Dataelliando dias
 
Data recovery-software
Data recovery-softwareData recovery-software
Data recovery-softwareSonika Rawat
 
My First Hadoop Program !!!
My First Hadoop Program !!!My First Hadoop Program !!!
My First Hadoop Program !!!Ayapparaj SKS
 
Outlook PST Files Serving Role of Outlook Data Files
Outlook PST Files Serving Role of Outlook Data FilesOutlook PST Files Serving Role of Outlook Data Files
Outlook PST Files Serving Role of Outlook Data FilesforensicEmailAnalysis
 

What's hot (18)

Google - Bigtable
Google - BigtableGoogle - Bigtable
Google - Bigtable
 
S3 l5 db2 - process model
S3 l5   db2 - process modelS3 l5   db2 - process model
S3 l5 db2 - process model
 
Physical architecture of sql server
Physical architecture of sql serverPhysical architecture of sql server
Physical architecture of sql server
 
Sql Server Basics
Sql Server BasicsSql Server Basics
Sql Server Basics
 
MS-SQL SERVER ARCHITECTURE
MS-SQL SERVER ARCHITECTUREMS-SQL SERVER ARCHITECTURE
MS-SQL SERVER ARCHITECTURE
 
Google Big Table
Google Big TableGoogle Big Table
Google Big Table
 
Introducing ms sql_server_updated
Introducing ms sql_server_updatedIntroducing ms sql_server_updated
Introducing ms sql_server_updated
 
Exchange Server Recovery
Exchange Server RecoveryExchange Server Recovery
Exchange Server Recovery
 
NOSQL and MongoDB Database
NOSQL and MongoDB DatabaseNOSQL and MongoDB Database
NOSQL and MongoDB Database
 
Randomizing Data With SQL Server
Randomizing Data With SQL ServerRandomizing Data With SQL Server
Randomizing Data With SQL Server
 
Bigtable: A Distributed Storage System for Structured Data
Bigtable: A Distributed Storage System for Structured DataBigtable: A Distributed Storage System for Structured Data
Bigtable: A Distributed Storage System for Structured Data
 
Data recovery-software
Data recovery-softwareData recovery-software
Data recovery-software
 
Apache hive
Apache hiveApache hive
Apache hive
 
NoSql Introduction
NoSql IntroductionNoSql Introduction
NoSql Introduction
 
My First Hadoop Program !!!
My First Hadoop Program !!!My First Hadoop Program !!!
My First Hadoop Program !!!
 
Pig
PigPig
Pig
 
Sql server basics
Sql server basicsSql server basics
Sql server basics
 
Outlook PST Files Serving Role of Outlook Data Files
Outlook PST Files Serving Role of Outlook Data FilesOutlook PST Files Serving Role of Outlook Data Files
Outlook PST Files Serving Role of Outlook Data Files
 

Similar to Sample database design methodology

Big file tablespaces
Big file tablespacesBig file tablespaces
Big file tablespacesdev3993
 
Class viii ch-2 log on to access
Class  viii ch-2 log on to accessClass  viii ch-2 log on to access
Class viii ch-2 log on to accessjessandy
 
MySQL 8 Server Optimization Swanseacon 2018
MySQL 8 Server Optimization Swanseacon 2018MySQL 8 Server Optimization Swanseacon 2018
MySQL 8 Server Optimization Swanseacon 2018Dave Stokes
 
Relational database concept and technology
Relational database concept and technologyRelational database concept and technology
Relational database concept and technologyDucat
 
MySQL 8 Tips and Tricks from Symfony USA 2018, San Francisco
MySQL 8 Tips and Tricks from Symfony USA 2018, San FranciscoMySQL 8 Tips and Tricks from Symfony USA 2018, San Francisco
MySQL 8 Tips and Tricks from Symfony USA 2018, San FranciscoDave Stokes
 
Bt0066 database management system1
Bt0066 database management system1Bt0066 database management system1
Bt0066 database management system1Techglyphs
 
A Review of Data Access Optimization Techniques in a Distributed Database Man...
A Review of Data Access Optimization Techniques in a Distributed Database Man...A Review of Data Access Optimization Techniques in a Distributed Database Man...
A Review of Data Access Optimization Techniques in a Distributed Database Man...Editor IJCATR
 
A Review of Data Access Optimization Techniques in a Distributed Database Man...
A Review of Data Access Optimization Techniques in a Distributed Database Man...A Review of Data Access Optimization Techniques in a Distributed Database Man...
A Review of Data Access Optimization Techniques in a Distributed Database Man...Editor IJCATR
 
Sql Health in a SharePoint environment
Sql Health in a SharePoint environmentSql Health in a SharePoint environment
Sql Health in a SharePoint environmentEnrique Lima
 
Sql server lesson3
Sql server lesson3Sql server lesson3
Sql server lesson3Ala Qunaibi
 
A STUDY ON GRAPH STORAGE DATABASE OF NOSQL
A STUDY ON GRAPH STORAGE DATABASE OF NOSQLA STUDY ON GRAPH STORAGE DATABASE OF NOSQL
A STUDY ON GRAPH STORAGE DATABASE OF NOSQLijscai
 
A Study on Graph Storage Database of NOSQL
A Study on Graph Storage Database of NOSQLA Study on Graph Storage Database of NOSQL
A Study on Graph Storage Database of NOSQLIJSCAI Journal
 
A STUDY ON GRAPH STORAGE DATABASE OF NOSQL
A STUDY ON GRAPH STORAGE DATABASE OF NOSQLA STUDY ON GRAPH STORAGE DATABASE OF NOSQL
A STUDY ON GRAPH STORAGE DATABASE OF NOSQLijscai
 
A Study on Graph Storage Database of NOSQL
A Study on Graph Storage Database of NOSQLA Study on Graph Storage Database of NOSQL
A Study on Graph Storage Database of NOSQLIJSCAI Journal
 
Database Management Systems (Mcom Ecommerce)
Database Management Systems (Mcom Ecommerce)Database Management Systems (Mcom Ecommerce)
Database Management Systems (Mcom Ecommerce)Rupen Parte
 
Unity Connect - Getting SQL Spinning with SharePoint - Best Practices for the...
Unity Connect - Getting SQL Spinning with SharePoint - Best Practices for the...Unity Connect - Getting SQL Spinning with SharePoint - Best Practices for the...
Unity Connect - Getting SQL Spinning with SharePoint - Best Practices for the...Knut Relbe-Moe [MVP, MCT]
 

Similar to Sample database design methodology (20)

Big file tablespaces
Big file tablespacesBig file tablespaces
Big file tablespaces
 
Class viii ch-2 log on to access
Class  viii ch-2 log on to accessClass  viii ch-2 log on to access
Class viii ch-2 log on to access
 
MySQL 8 Server Optimization Swanseacon 2018
MySQL 8 Server Optimization Swanseacon 2018MySQL 8 Server Optimization Swanseacon 2018
MySQL 8 Server Optimization Swanseacon 2018
 
Relational database concept and technology
Relational database concept and technologyRelational database concept and technology
Relational database concept and technology
 
MySQL 8 Tips and Tricks from Symfony USA 2018, San Francisco
MySQL 8 Tips and Tricks from Symfony USA 2018, San FranciscoMySQL 8 Tips and Tricks from Symfony USA 2018, San Francisco
MySQL 8 Tips and Tricks from Symfony USA 2018, San Francisco
 
Sql project ..
Sql project ..Sql project ..
Sql project ..
 
Database fundamentals
Database fundamentalsDatabase fundamentals
Database fundamentals
 
Bt0066 database management system1
Bt0066 database management system1Bt0066 database management system1
Bt0066 database management system1
 
A Review of Data Access Optimization Techniques in a Distributed Database Man...
A Review of Data Access Optimization Techniques in a Distributed Database Man...A Review of Data Access Optimization Techniques in a Distributed Database Man...
A Review of Data Access Optimization Techniques in a Distributed Database Man...
 
A Review of Data Access Optimization Techniques in a Distributed Database Man...
A Review of Data Access Optimization Techniques in a Distributed Database Man...A Review of Data Access Optimization Techniques in a Distributed Database Man...
A Review of Data Access Optimization Techniques in a Distributed Database Man...
 
Sql Health in a SharePoint environment
Sql Health in a SharePoint environmentSql Health in a SharePoint environment
Sql Health in a SharePoint environment
 
DATABASE ADMINSTRATION
DATABASE ADMINSTRATION DATABASE ADMINSTRATION
DATABASE ADMINSTRATION
 
Sql server lesson3
Sql server lesson3Sql server lesson3
Sql server lesson3
 
Oracle tutorial
Oracle tutorialOracle tutorial
Oracle tutorial
 
A STUDY ON GRAPH STORAGE DATABASE OF NOSQL
A STUDY ON GRAPH STORAGE DATABASE OF NOSQLA STUDY ON GRAPH STORAGE DATABASE OF NOSQL
A STUDY ON GRAPH STORAGE DATABASE OF NOSQL
 
A Study on Graph Storage Database of NOSQL
A Study on Graph Storage Database of NOSQLA Study on Graph Storage Database of NOSQL
A Study on Graph Storage Database of NOSQL
 
A STUDY ON GRAPH STORAGE DATABASE OF NOSQL
A STUDY ON GRAPH STORAGE DATABASE OF NOSQLA STUDY ON GRAPH STORAGE DATABASE OF NOSQL
A STUDY ON GRAPH STORAGE DATABASE OF NOSQL
 
A Study on Graph Storage Database of NOSQL
A Study on Graph Storage Database of NOSQLA Study on Graph Storage Database of NOSQL
A Study on Graph Storage Database of NOSQL
 
Database Management Systems (Mcom Ecommerce)
Database Management Systems (Mcom Ecommerce)Database Management Systems (Mcom Ecommerce)
Database Management Systems (Mcom Ecommerce)
 
Unity Connect - Getting SQL Spinning with SharePoint - Best Practices for the...
Unity Connect - Getting SQL Spinning with SharePoint - Best Practices for the...Unity Connect - Getting SQL Spinning with SharePoint - Best Practices for the...
Unity Connect - Getting SQL Spinning with SharePoint - Best Practices for the...
 

Recently uploaded

KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 

Recently uploaded (20)

KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 

Sample database design methodology

  • 1. SAMPLE DATABASE DESIGN METHODOLOGY USING MS SQL SERVER 2017 This is a sample Database Design Methodology using MS SQL Server 2017 T-SQL scripts in which the following basic concepts will be explained in a minimalistic but concise manner for the DBA to understand: 1. Database Creation 2. Filegroups 3. Files 4. Tables 5. Indexes 6. Storage Considerations Author: Wally M. Pons E-mail: wpons@datagrupo.com Twitter: @Datagrupo Facebook: Datagrupo Date Published: Sept-23-2018 Corrected/Revised on: N/A
  • 2. DATABASE CREATION (1 OF 3)  Normally (but not necessarily), MS SQL Server Databases are by default created with two files, one is called the primary data and the other is the transaction log. Additional files that you create are called secondary files and can be created when needed or at any given moment in time.  The main function of the primary data is to hold information about objects within the database, here is a short list of the most common objects that may be included in it: 1. Tables 2. Primary Keys 3. Indexes 4. Blobs 5. Stored Procedures 6. Triggers 7. Functions 8. Diagrams 9. Data Types 10. Defaults 11. Views
  • 3. DATABASE CREATION (2 OF 3)  On the previous list, the first four objects appear on bold letters, this indicates that they specifically store the data you input on the database, therefore each one of them requires a special handling involving a Filegroup and a secondary data file for this purpose.  The rest of the items listed can reside on the primary filegroup as they are only stored as text and do not account on the total of records held on the database.  To put things in perspective, a few hundreds or even thousands of those objects (5 to 11 from the list) may account for roughly 50 MB† of data. This is an accurate number from real world data, nevertheless, if you feel that you require more than 50 MB then you may increase it to your needs.  † MB stands for Megabyte, it is the equivalent of 1,048,576 Bytes, a Byte can be also described as one character, this includes spaces, special characters and punctuations marks too.
  • 4. DATABASE CREATION (3 OF 3)  The following T-SQL shows how to create a database, please note that you must first create the folders manually and in convenience with your environment, which could be different to the one shown below. Please feel free to make any changes to the script to accommodate the aforementioned.
  • 5. FILEGROUPS  In order to have your secondary data files properly segmented, you must create the necessary Filegroups that can hold them. Unlike a physical file, a Filegroup is a logical structure which groups the files that compose your database. On MS SQL Server you can create a total of 32,767 Filegroups per database, just as the same number of physical files.  In order to keep with the good documentation practice (GDocP), always use standardization when creating object names, similar to the “Leszynski naming convention”, it helps you and other people to better understand your design methodologies. Below is the T-SQL code to create the Filegroups for a table in our “DB_SAMPLE_2017” database:  In this case the Filegroup name starts with “Fg”, then the type (Tbl=Table, PK=Primary Key, Idx=Index, Blb=Blob / Binary data), name of the object and in cases other than tables you must include the field name(s).
  • 6. FILES  Once we have our Filegroups defined we proceed to create the necessary files and assign them accordingly. Quick note: Files are also called “Devices” by some SQL developers.  On the above T-SQL script we can see the most important details in the file creation process from left to right: 1. NAME: (logical within SQL Server) Is the internal name of the file. 2. FILENAME: Is the physical name of the file including the extension. 3. SIZE: Is the initially physical size of the file, optionally we put a percentile growth but it can also be specified on MB. 4. TO FILEGROUP: This is where we specify the name of the Filegroup to which the file belongs.
  • 7. TABLES  The following T-SQL script shows a customers table with its filegroups, defaults (constraints), data types, Primary Key and blob field. Please feel free to make any changes to this script to accommodate it to your needs.
  • 8. INDEXES  The following T-SQL script shows an index by the “SSN” field, the purpose of this is to enhance search and sorting by this field, also note that it is a NON CLUSTERED index, which means it does not index other fields on the table, if you require to perform the same operation by other fields you will need to create the Filegroup + File for the new index along with the script. Please feel free to make any changes to this script to accommodate it to your needs.
  • 9. STORAGE CONSIDERATIONS  Finally, the database has been created and you are tentatively ready to input data, but before you do that you also need to know how much data space can the table hold and what would be the storage cost in MB (or GB / TB) for your disks, after all, you don’t want to run out of space. We execute the following T-SQL using SSMS to view the required information:  It takes 1,048,576 Bytes to complete a Megabyte, which means that by the time you have around 3,826 records / rows of data you will also have taken close to 1 MB of space from your physical disk.
  • 10. THANKS / T-SQL SCRIPT DOWNLOAD LINK  Thank you for taking the time on reading this sample database design methodology guide, I hope it was helpful to your knowledge. Please feel free to download a copy of the T-SQL that has been used here in, it is available from my website in a text format on the following link: https://datagrupo.com/db_sample_2017/Create_DB_SAMPLE_2017.txt  You may also send me an email with any questions regarding this material, which is included “As Is” and without warranty, that is unless I give you the file in person, make a copy of it to your device and run it.  Last but not least, please follow me on twitter and/or like my facebook page for datagrupo. Yours truly, Wally M. Pons