{"id":92,"date":"2010-09-14T17:41:10","date_gmt":"2010-09-15T00:41:10","guid":{"rendered":"http:\/\/www.larrylawhead.com\/articles\/?p=92"},"modified":"2010-09-14T17:41:10","modified_gmt":"2010-09-15T00:41:10","slug":"data-dictionary","status":"publish","type":"post","link":"https:\/\/www.larrylawhead.com\/articles\/2010\/09\/data-dictionary\/","title":{"rendered":"Data Dictionary"},"content":{"rendered":"<h3><span style=\"color: #888888;\">Oh Yeah, Data &#8211; Poor it on!<\/span><\/h3>\n<p>What&#8217;s a company without lots of little bits of information that need to be managed? Like the Class Diagram and Sequence Diagram, the Data Dictionary is invaluable when the system is handed-off to new developers or a third party integration team. Instead of spending hours using SQL Query Analyzer or Enterprise Manager trying to gain an overview of the relationships, your document should offer a quick read about how the system manages its data. Here is a document walk through that you may find helpful.<\/p>\n<p>Before you begin, check with the DBA to insure you have a user name and password to access the current server and the database. (If he gives you &#8220;sa&#8221; without a password, don&#8217;t tell anyone; just cry.) Pre-supposing you&#8217;re working with a Microsoft SQL system, open the SQL Server Enterprise Manager (version 8.0). Depending on how the manager is configured you may have to click a ways to get to your tables.<\/p>\n<p>When you arrive at the server name, click the icon bearing the server name and the manager will open the files belonging to that server. Click &#8220;Databases&#8221;. From the list choose the database you are about to document. Choose &#8220;Tables&#8221;. Click the &#8220;Type&#8221; column until all the &#8220;User&#8221; type tables are at the top of your list.<\/p>\n<p>The first thing you will usually notice is a lot of names that have the same prefixes. You should ask the DBA or developer to familiarize you with the naming convention of the &#8220;User&#8221; type tables. Document that convention at an appendix to the Data Dictionary. When I create table names, I like placing an underscore before the table name. That way I can identify my tables at a glance. However, every company has their own naming convention and this should be noted.<\/p>\n<p>Right click the name of the user defined table name and choose &#8220;Properties&#8221;. In the &#8220;General&#8221; tab note the column name, their data types, size (length) and if they allow NULLS (required). Note the primary key (PK) now. We&#8217;ll get to the foreign key constraints (FK) later. Click the &#8220;Full-Text Indexing&#8221; tab to document the indexed columns. Next, document the permissions. Click the &#8220;General&#8221; tab again and click the &#8220;Permissions&#8221; button. Note the permissions as they appear in the &#8220;Permissions&#8221; tab.<\/p>\n<p>To document the foreign key constraints (FK), close the &#8220;Tables Properties&#8221; form and click the &#8220;Diagrams&#8221; icon in the &#8220;console&#8221; window to the left. Normally, the developer or DBA will have already created a relationship diagram. If there is more than one, ask the master blaster person who created the diagrams which one contains a complete overview of the relationships.<\/p>\n<p>Once you&#8217;ve found the correct diagram, right click your way through the table names. Choose each time &#8220;Properties&#8221; from the drop-down menu. Choose the &#8220;Relationships&#8221; tab. First check how many relationships your table may have by clicking on the &#8220;Selected relationship&#8221; drop-down list. Choose the top item in the list. Copy the name of that relationship as it appears in the &#8220;Relationship name&#8221; text box. Find the table&#8217;s name in your dictionary. Now paste the relationship name in the section entitled &#8220;Foreign Key Restraints&#8221; in your dictionary. Do this for each relationship in the drop-down list. If no relationships appear in the &#8220;Relationships&#8221; tab, then there are none.<\/p>\n<p>If there are no diagrams, you may create one by right clicking the empty diagram window to the right choosing &#8220;New Database Diagram&#8221; from the drop-down menu. Work the &#8220;Create Database Diagram Wizard&#8221; through. At the section entitled &#8220;Select Tables to be Added&#8221;, simply mark all the &#8220;Available tables&#8221; to the left of the pane and add them all to the &#8220;Tables to add to diagram&#8221; pane to the right. Click &#8220;next&#8221;. The wizard may warn you that it will take a while to create the diagram, but since you don&#8217;t have a clue as to which tables contain relationships and which don&#8217;t. Your options are limited. Go for a soda or some water. It usually doesn&#8217;t take very long, unless you have some very large tables.<\/p>\n<p>Now to finish the database documentation set, enter some sample data. To save a lot of time, run a simple SELECT query on the table. Here&#8217;s how you can do this between now and when you become a SQL query pro.<\/p>\n<p>Click the &#8220;Tables&#8221; icon in the left console window and click on the &#8220;Table&#8221; icon under the database you are documenting. In the right pane of the Enterprise Manager, right click the table you want to document. From menu choose &#8220;Open Table | Choose Top&#8221;\u00a6&#8221;. The &#8220;Number of Rows&#8221; text box appears. Enter a number like 3 in the text area and click the &#8220;OK&#8221; button. The system runs the SELECT query for you on the three top records.<\/p>\n<p>In the Data Dictionary that reports the architecture of the table you choose, go to the final section entitled &#8220;Data Example&#8221;. I&#8217;ve used, a place holder text entitled &#8220;Column Name Here&#8221;. Overwrite this text with the names of the columns returned by your query. The first column name could look something like PubLanguage. Under the field name, enter the 3 results returned from your SQL Query. Here I&#8217;ve entered some place holder text entitled &#8220;Sample Data Here&#8221;. In this example the query results may read &#8220;Slovensko&#8221;, &#8220;Deutsch&#8221; and &#8220;English&#8221;.<\/p>\n<p>Heed this word of warning! Do not, under any circumstances, use real personal data or names of people. Mix-up names or use &#8220;First Name&#8221; &#8220;Last Name&#8221;. If a field name contains Social Security, telephone for fax numbers, use an &#8220;x&#8221; to represent the numbers and don&#8217;t add any character that is not in the original record. If the telephone number is 3333333333 then you may enter xxxxxxxxxx. Do not enter xxx-xxx-xxxx. This may mislead the DBA or developer as to the data type used. That should just about do it.<\/p>\n<p>As with the Class and Sequence diagrams, you don&#8217;t have to be a developer or DBA to document the data architecture, but if you want to become a more valuable asset then you should learn as much as you possibly can in both the field of writing programs and developing databases. Sure it&#8217;s a lot of work, but so is living. Just blame the inconvenience on Adam and Eve or someone.<\/p>\n<p><strong>Articles Additional Resources<\/strong><\/p>\n<p>Here are some great places to begin your journey to understanding databases.<br \/>\n<a href=\"http:\/\/en.wikipedia.org\/wiki\/Database_normalization\" target=\"_bold\">Wikipedia Article on Normalization <\/a><br \/>\n<a href=\"http:\/\/databases.about.com\/od\/specificproducts\/a\/normalization.htm\" target=\"_bold\">Database Normalization<\/a> by Mike Chapple<br \/>\n<a href=\"http:\/\/www.datamodel.org\/NormalizationRules.html\" target=\"_bold\">Rules of Data Normalization<\/a> by Data Model.org<\/p>\n<p><strong>Template<\/strong><\/p>\n<p>This document may not contain everything required in a specific dictionary, but it does cover all the major areas.<br \/>\n<a href=\"http:\/\/www.larrylawhead.com\/sites\/default\/Files\/Examples\/DataDictionary.swf\" target=\"_bold\">Flash Paper<\/a><br \/>\n<a href=\"http:\/\/www.larrylawhead.com\/sites\/default\/Files\/Examples\/DataDictionary.pdf\" target=\"_bold\">PDF<\/a><br \/>\n<a href=\"http:\/\/www.larrylawhead.com\/sites\/default\/Files\/Examples\/DataDictionary.dot\" target=\"_bold\">Word Template<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Oh Yeah, Data &#8211; Poor it on! What&#8217;s a company without lots of little bits of information that need to be managed? Like the Class Diagram and Sequence Diagram, the Data Dictionary is invaluable when the system is handed-off to new developers or a third party integration team. Instead of spending hours using SQL Query<\/p>\n<p class=\"more-link\"><a href=\"https:\/\/www.larrylawhead.com\/articles\/2010\/09\/data-dictionary\/\" class=\"themebutton2\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[4],"tags":[],"class_list":["post-92","post","type-post","status-publish","format-standard","hentry","category-product-owner"],"_links":{"self":[{"href":"https:\/\/www.larrylawhead.com\/articles\/wp-json\/wp\/v2\/posts\/92","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.larrylawhead.com\/articles\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.larrylawhead.com\/articles\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.larrylawhead.com\/articles\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.larrylawhead.com\/articles\/wp-json\/wp\/v2\/comments?post=92"}],"version-history":[{"count":2,"href":"https:\/\/www.larrylawhead.com\/articles\/wp-json\/wp\/v2\/posts\/92\/revisions"}],"predecessor-version":[{"id":113,"href":"https:\/\/www.larrylawhead.com\/articles\/wp-json\/wp\/v2\/posts\/92\/revisions\/113"}],"wp:attachment":[{"href":"https:\/\/www.larrylawhead.com\/articles\/wp-json\/wp\/v2\/media?parent=92"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.larrylawhead.com\/articles\/wp-json\/wp\/v2\/categories?post=92"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.larrylawhead.com\/articles\/wp-json\/wp\/v2\/tags?post=92"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}