Download presentation
Presentation is loading. Please wait.
1
Mapping Shema and Recursively Managing Data
Ed Pollack Sr. Database Administrator Autotask
2
Agenda Reporting and learning about schema and data relationships:
Introduction. Data integrity and relationships. Demo: Review of system views. Demo: Build a relationship crawling machine! Conclusion. Questions!? Where to find me.
3
Introduction (What is this All About?)
Understanding database organization can be very useful! How do tables relate to each other? How does data within tables relate (if it exists)? How is all of this useful to us?
4
Data Integrity and Relationships
Most databases rely on relationships to organize data. Columns in a table reference primary keys in other tables. What does lack of data integrity look like? Orphaned data!? Bad data!! Inconsistent Data!!! How do we alter data and maintain data integrity?
5
How Do We Delete Data We can build all foreign keys with ON DELETE…
CASCADE SET NULL DO NOTHING This is 100% OK if your applications/schema are built to support this. We can play the trial & error game (?!) We can choose to not delete data (?!) We can build a tool to help us!
6
An Example ERD Database diagrams use foreign keys to build
up relationships Many other tools can do this, too!
7
System Views Demo
8
Mapping Schema Recursively
Demo
9
What if I Don’t Have any Foreign Keys?
Mapping relationships is still important! Use that mapping to generate foreign key metadata, a data dictionary, or something similar. Use that metadata to drive reports, utilities, etc… Even unstructured/non-relational databases have the ability to generate links (aka: relationships) between documents!
10
Conclusion TSQL can be used to traverse database relationships.
We can learn about our data. We can map schema relationships… …but we can also map out DATA relationships!!!!! Creative scripting can save immense time/effort. Enjoy!
11
Questions???
12
Contact Info & Links Ed SQL Shack SQL Server Central SQL Saturday Albany (2017) Thank you!!!
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.