SlideShare a Scribd company logo
Data Integrity Demystified
Deborah Melkin
sheher
March 10, 2021
About Me
• 20 years as a DBA
• Mainly work with SQL Server
• Mainly work with OLTP but have worked with some data marts.
• NESQL Board Member
• SQL SaturdayUser Group Speaker
• IDERA ACE Class of 2020
• Speaker Idol Winner 2019
• Microsoft MVP – Data Platform
Random facts:
Agenda
• Setting the Foundation
• Designing for the Data
• Data Integrity & Performance
Let’s Define “Integrity”
“Integrity”
https://www.merriam-webster.com/dictionary/integrity
“Data Integrity”
…the maintenance of, and the assurance of, the
accuracy and consistency of data over its entire life-
cycle, and is a critical aspect to the design,
implementation and usage of any system which
stores, processes, or retrieves data.…
https://en.wikipedia.org/wiki/Data_integrity
What Does It Mean???
?
?
?
?
?
? ?
Why Does This Matter?
• “Garbage In – Garbage Out”
• Trust of data
• Not independent of other data
• Accessed by multiple sources
• Solve problems before they happen
Setting the Foundation…
Data Storage & Data Engines
• Relational Database
• NoSQL Database
• Data Lake
• Excel
• Text File
• etc….
Naming Conventions
• Capitalization and punctuation
• Character limits
• Singular or Plural table name
• TLA (three letter aliases) or other prefixes
• Schemas
Naming Convention Examples
Foundations Create Integrity By…
• Defining the structure of the data
• Understanding the type of data at the start
• Looking at names to easily understand what
the data represents by
• Creating consistency and a structure to the
definitions used in the database
Designing for the Data…
Different Types of Integrity
• Entity Integrity
– About the table (entity)
• Referential Integrity
– About the relationships between tablesentities
• Domain Integrity
– About the column (attribute)
Entity Integrity
Relational Database Design
• Normal Form vs. Star Schema
• Determines how to group the different
pieces of data in a logical way
• Provides additional meaning based on the
column’s “role” on the table
Primary Key Constraint
• Column or combination of columns that
define the uniqueness of each record of the
table
• All columns must be NOT NULL
• Only 1 primary key per table
• Logical vs Physical
Tip: Identify Primary Key Column(s)
Ask the following question:
What does this table hold using 1 or 2
sentences?
Surrogate Primary Key
https://www.merriam-webster.com/dictionary/surrogate
Do Surrogate PKs Create Integrity?
They Don’t!
Do Surrogate PKs Create Integrity?
“If you stand for nothing, you will fall for anything.”
If your surrogate primary key stands for
nothing,
your data integrity will “fall.”
Unique Key Constraint
• Column or combinations of columns that
create a unique set in addition to the Primary
Key.
• Not as strict as Primary Key – allows for NULL
columns.
• Can have multiple unique combinations.
Unique Key Constraint (cont’d)
• Difference between a Unique Key and a
Unique Index:
• Use of filtered indexes
• Use of included columns
What does Entity Integrity do?
• Defines the relationship between…
• the columns on the table
• the tables themselves
• Creates a clear definition of what each record
is about
What does Entity Integrity do?
• Creates all of the alternate primary key
combinations or the logical primary key in case
of a surrogate primary key
• Enforces additional business rules
Referential Integrity
Foreign Key Constraint
• Creates relationship between two tables
• Ensures that the value in the field exists in
the referenced table
• Can define actions that occur when the
referenced column is changed or the row is
removed
Foreign Key Example
Need to add a
“Discontinued”
column
What does Referential Integrity do?
• Ensures that data that is related to other
tables is valid
• Defines rules for handling changes with the
referenced column to maintain the data
integrity
Domain Integrity
Data Types
• Sets the type of data we are dealing with
• Creates constraints on the data goes inside
the attribute
• Can guarantee valid data
Data Types
NOT NULL
• NULL is the absence of a value
• Sets the requirement as to whether the
attribute must have a value
• ‘’ (empty string) <> NULL
NOT NULL
Default Constraint
• Set the value for a column if the value for the
column is not specified
• Ignored if the value is specified as NULL
• Applies to Inserts or Foreign Key with SET
DEFAULT
Check Constraint
• Creates restrictions on the data that goes in
the column
• Ensuring the data in the field matches a given
criteria
• Can be created on the column or table level
• Table level means that multiple columns can be
checked at once
What Does Domain Integrity Do?
• Defines the type of data expected for each
column
• Ensures the data in the column matches what
should be there
• Sets whether the field is required to have a
value
What Does Domain Integrity Do?
• Establishes the common known value for the
field when the record is first inserted
• Ensures that only the values that we expect
to find in the column (or table) are there
• Eliminates a way for bad data to get in our
tables
Data Integrity &
Performance
Clustered Index: Integrity or
Performance
Clustered index defines the order of how the
data in the table is physically stored.
Integrity Performanc
e
Integrity and the Query Optimizer
• NOT NULL
• Primary Key Constraints
• Unique Constraints
• Foreign Key Constraints
• Check Constraints
Data Types Performance
• Database size bloat
• Memory Grant
• Implicit Conversions
Demos!
Parting Thoughts…
Is Data Integrity 100% Achievable?
No!
• But it is worthwhile to figure out what is
needed to create true data integrity to better
understand and work with your data.
Remember this?
?
?
?
?
?
? ?
So What Did It Stand for?
References
• https://docs.microsoft.com/en-us/sql/relational-
databases/tables/unique-constraints-and-check-
constraints?view=sql-server-ver15
• https://littlekendra.com/2016/09/08/unique-constraints-
vs-unique-indexes/
References (cont’d)
• https://debthedba.wordpress.com/2018/10/31/how-i-
really-feel-about-surrogate-primary-keys/
• https://www.scarydba.com/2015/09/09/yes-foreign-
keys-help-performance/
• https://www.sqlservercentral.com/articles/trust-or-
verify-%E2%80%93-how-fks-can-or-cannot-help-
performance
Thank you for Coming!
Email: dgmelkin@gmail.com
Twitter: @dgmelkin
Blog: DebtheDBA.wordpress.com
GitHub: https://tinyurl.com/y5dpvue2

More Related Content

PPTX
Geek Sync | SQL Security Principals and Permissions 101
PPTX
Geek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERA
PDF
SQL Server 2019 Data Virtualization
PPTX
Be Proactive: A Good DBA Goes Looking for Signs of Trouble | IDERA
PDF
Azure sql database limitations
PPTX
Azure cosmos db, Azure no-SQL database,
PPTX
How SQL Server 2016 SP1 Changes the Game
PDF
Modernizing your database with SQL Server 2019
Geek Sync | SQL Security Principals and Permissions 101
Geek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERA
SQL Server 2019 Data Virtualization
Be Proactive: A Good DBA Goes Looking for Signs of Trouble | IDERA
Azure sql database limitations
Azure cosmos db, Azure no-SQL database,
How SQL Server 2016 SP1 Changes the Game
Modernizing your database with SQL Server 2019

What's hot (20)

PPTX
SQL Server R Services: What Every SQL Professional Should Know
PDF
Using extended events for troubleshooting sql server
DOCX
Sql vs NO-SQL database differences explained
PPS
PPTX
Enhancements that will make your sql database roar sp1 edition sql bits 2017
PPTX
Scalable relational database with SQL Azure
PDF
SQL vs. NoSQL
PPTX
Stretch Database
PPTX
Brk3043 azure sql db intelligent cloud database for app developers - wash dc
PDF
SQL Server 2017 Enhancements You Need To Know
PDF
Troubleshooting sql server
PPTX
SQL Server 2016 New Features and Enhancements
PDF
SQL Server 2016 novelties
PDF
Application Development with Apache Cassandra as a Service
PPTX
SQL Server 2016: Just a Few of Our DBA's Favorite Things
PPTX
Sql server hybrid what every sql professional should know
PPTX
Getting started with postgresql
PPTX
DAC 2012
PDF
Cassandra Community Webinar: From Mongo to Cassandra, Architectural Lessons
PDF
A to z for sql azure databases
SQL Server R Services: What Every SQL Professional Should Know
Using extended events for troubleshooting sql server
Sql vs NO-SQL database differences explained
Enhancements that will make your sql database roar sp1 edition sql bits 2017
Scalable relational database with SQL Azure
SQL vs. NoSQL
Stretch Database
Brk3043 azure sql db intelligent cloud database for app developers - wash dc
SQL Server 2017 Enhancements You Need To Know
Troubleshooting sql server
SQL Server 2016 New Features and Enhancements
SQL Server 2016 novelties
Application Development with Apache Cassandra as a Service
SQL Server 2016: Just a Few of Our DBA's Favorite Things
Sql server hybrid what every sql professional should know
Getting started with postgresql
DAC 2012
Cassandra Community Webinar: From Mongo to Cassandra, Architectural Lessons
A to z for sql azure databases
Ad

Similar to Geek Sync | Data Integrity Demystified - Deborah Melkin | IDERA (20)

PPT
demo2.ppt
PPT
Database intro
PDF
0929 databases
PPTX
SQL things ace series of the thing useful
PPTX
The SQL Query Language: Simple SELECT Commands
PPTX
DBMS:Relational Modal
PPT
Database Constraints.ppt
PPTX
Geek Sync | Looking "Normal" and Seeing "Stars": Table Designs Working Together
PPTX
Build a modern data platform.pptx
PDF
Access 05
PDF
Database Indexes
PPTX
Lecture 2 sql {basics date type, constrains , integrity types etc.}
PDF
Reviewing basic concepts of relational database
PPTX
Schema less table & dynamic schema
PDF
RDBMS Model
PPTX
Database Engineering: Part one
PPTX
Relational Data Model.pptx
PDF
Building better SQL Server Databases
PPTX
db design and maintenance part 1.pptx
PPTX
Data Never Lies Presentation for beginners in data field.pptx
demo2.ppt
Database intro
0929 databases
SQL things ace series of the thing useful
The SQL Query Language: Simple SELECT Commands
DBMS:Relational Modal
Database Constraints.ppt
Geek Sync | Looking "Normal" and Seeing "Stars": Table Designs Working Together
Build a modern data platform.pptx
Access 05
Database Indexes
Lecture 2 sql {basics date type, constrains , integrity types etc.}
Reviewing basic concepts of relational database
Schema less table & dynamic schema
RDBMS Model
Database Engineering: Part one
Relational Data Model.pptx
Building better SQL Server Databases
db design and maintenance part 1.pptx
Data Never Lies Presentation for beginners in data field.pptx
Ad

More from IDERA Software (20)

PPTX
The role of the database administrator (DBA) in 2020: Changes, challenges, an...
PPTX
Problems and solutions for migrating databases to the cloud
PPTX
Public cloud uses and limitations
PPTX
Optimize the performance, cost, and value of databases.pptx
PPTX
Monitor cloud database with SQL Diagnostic Manager for SQL Server
PPTX
Database administrators (dbas) face increasing pressure to monitor databases
PPTX
Six tips for cutting sql server licensing costs
PDF
Idera live 2021: The Power of Abstraction by Steve Hoberman
PDF
Idera live 2021: Why Data Lakes are Critical for AI, ML, and IoT By Brian Flug
PDF
Idera live 2021: Will Data Vault add Value to Your Data Warehouse? 3 Signs th...
PDF
Idera live 2021: Managing Digital Transformation on a Budget by Bert Scalzo
PDF
Idera live 2021: Keynote Presentation The Future of Data is The Data Cloud b...
PDF
Idera live 2021: Managing Databases in the Cloud - the First Step, a Succes...
PDF
Idera live 2021: Database Auditing - on-Premises and in the Cloud by Craig M...
PDF
Idera live 2021: Performance Tuning Azure SQL Database by Monica Rathbun
PPTX
How Users of a Performance Monitoring Tool Can Benefit from an Inventory Mana...
PPTX
Benefits of Third Party Tools for MySQL | IDERA
PPTX
Achieve More with Less Resources | IDERA
PPTX
Benefits of SQL Server 2017 and 2019 | IDERA
PPTX
Advanced SQL Server Performance Tuning | IDERA
The role of the database administrator (DBA) in 2020: Changes, challenges, an...
Problems and solutions for migrating databases to the cloud
Public cloud uses and limitations
Optimize the performance, cost, and value of databases.pptx
Monitor cloud database with SQL Diagnostic Manager for SQL Server
Database administrators (dbas) face increasing pressure to monitor databases
Six tips for cutting sql server licensing costs
Idera live 2021: The Power of Abstraction by Steve Hoberman
Idera live 2021: Why Data Lakes are Critical for AI, ML, and IoT By Brian Flug
Idera live 2021: Will Data Vault add Value to Your Data Warehouse? 3 Signs th...
Idera live 2021: Managing Digital Transformation on a Budget by Bert Scalzo
Idera live 2021: Keynote Presentation The Future of Data is The Data Cloud b...
Idera live 2021: Managing Databases in the Cloud - the First Step, a Succes...
Idera live 2021: Database Auditing - on-Premises and in the Cloud by Craig M...
Idera live 2021: Performance Tuning Azure SQL Database by Monica Rathbun
How Users of a Performance Monitoring Tool Can Benefit from an Inventory Mana...
Benefits of Third Party Tools for MySQL | IDERA
Achieve More with Less Resources | IDERA
Benefits of SQL Server 2017 and 2019 | IDERA
Advanced SQL Server Performance Tuning | IDERA

Recently uploaded (20)

PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Approach and Philosophy of On baking technology
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
A comparative study of natural language inference in Swahili using monolingua...
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
cloud_computing_Infrastucture_as_cloud_p
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPT
Teaching material agriculture food technology
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Assigned Numbers - 2025 - Bluetooth® Document
Programs and apps: productivity, graphics, security and other tools
Approach and Philosophy of On baking technology
Encapsulation_ Review paper, used for researhc scholars
Advanced methodologies resolving dimensionality complications for autism neur...
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Unlocking AI with Model Context Protocol (MCP)
A comparative study of natural language inference in Swahili using monolingua...
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Spectral efficient network and resource selection model in 5G networks
cloud_computing_Infrastucture_as_cloud_p
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Reach Out and Touch Someone: Haptics and Empathic Computing
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Teaching material agriculture food technology
Agricultural_Statistics_at_a_Glance_2022_0.pdf
gpt5_lecture_notes_comprehensive_20250812015547.pdf

Geek Sync | Data Integrity Demystified - Deborah Melkin | IDERA