<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Benjamin Finkel</title>
    <description>The latest articles on DEV Community by Benjamin Finkel (@benfinkel).</description>
    <link>https://dev.to/benfinkel</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F232361%2F111a8afd-bf97-4018-ba38-73c558a67f5e.jpg</url>
      <title>DEV Community: Benjamin Finkel</title>
      <link>https://dev.to/benfinkel</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/benfinkel"/>
    <language>en</language>
    <item>
      <title>Study Plan for DP-900: Azure Data Fundamentals</title>
      <dc:creator>Benjamin Finkel</dc:creator>
      <pubDate>Wed, 03 Feb 2021 23:16:49 +0000</pubDate>
      <link>https://dev.to/benfinkel/study-plan-for-dp-900-azure-data-fundamentals-coe</link>
      <guid>https://dev.to/benfinkel/study-plan-for-dp-900-azure-data-fundamentals-coe</guid>
      <description>&lt;p&gt;The Azure Data Fundamentals course is designed for data professionals of all levels who are moving their workloads from on-premises deployments to the Azure cloud. As a fundamentals course it covers a wide array of topics at a varying level of technical depth. &lt;a href="https://query.prod.cms.rt.microsoft.com/cms/api/am/binary/RE4wsKZ"&gt;Just see the exam outline found here to get a sense.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I took, and passed, this exam recently so as my content on &lt;a href="http://www.cbtnuggets.com"&gt;http://www.cbtnuggets.com&lt;/a&gt; rolls out for this course I thought I'd provide some insight into how and what you'll need to know in order to pass it yourself!&lt;/p&gt;

&lt;h2&gt;
  
  
  Describe core data concepts
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9nbLFwXh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/bendangerzone/image/upload/v1612390971/Dev.to/charts_ilcilo.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9nbLFwXh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/bendangerzone/image/upload/v1612390971/Dev.to/charts_ilcilo.jpg" alt="A bar chart"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The first section of the exam outline is the highest-level conceptually, but also the subject you're most likely to have some comfort level with already prior to beginning your studies.&lt;/p&gt;

&lt;p&gt;You'll need a basic understanding of what relational databases are and how they compare to non-relational or NoSQL databases. Questions about what technologies are used to query relational databases (SQL) may be found as well as general questions about how to recognize a relational database.&lt;/p&gt;

&lt;p&gt;This section also covers some basic data analysis topics, such as charts and graphing. Importantly you'll want to have a good grasp on the differences between the five listed analysis techniques: descriptive, diagnostic, predictive, prescriptive,&lt;br&gt;
cognitive.&lt;/p&gt;

&lt;p&gt;On top of that, recognizing what ETL (Extract, Transform, and Load) is and how it's used in a data pipeline will come up during this section of the exam.&lt;/p&gt;

&lt;h2&gt;
  
  
  Describe how to work with relational data on Azure
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sLgiqPop--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/bendangerzone/image/upload/v1612391317/Dev.to/pexels-photo-1181345_cau5mz.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sLgiqPop--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/bendangerzone/image/upload/v1612391317/Dev.to/pexels-photo-1181345_cau5mz.jpg" alt="Man studying whiteboard of code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With this section your knowledge is expected to dive a little deeper into the details. Questions for this topic are all about relational databases and how to leverage them on the Microsoft Azure cloud platform.&lt;/p&gt;

&lt;p&gt;Knowing the basic components of a relational database is important (Tables, Queries, Views, Indexes) as is a high-level understanding of an SQL query syntax. Do you know what SELECT means? How about INSERT? If the terms DDL and DML don't mean anything to you take some time to brush up on that.&lt;/p&gt;

&lt;p&gt;The exam will also spend some time testing your knowledge of the various Azure data services and how they are categorized and used. Know the difference between Azure's IaaS databases, PaaS databases, and SaaS databases. Understand pros and cons of choosing one of those solutions versus another for a given workload.&lt;/p&gt;

&lt;p&gt;You'll be expected to answer questions about using the Azure CLI versus PowerShell, or the GUI interface for database deployment. While there won't be specific questions about the syntax or commands you will need to be able to recognize the different methods. You will also need to understand which tools Azure offers for data management, what the important security systems in place are, and &lt;a href="https://docs.microsoft.com/en-us/azure/azure-sql/database/troubleshoot-common-errors-issues"&gt;how to troubleshoot basic connectivity issues.&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Describe how to work with non-relational data on Azure
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--f7cgywob--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/bendangerzone/image/upload/v1612391979/Dev.to/pexels-photo-207662_s8yd00.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--f7cgywob--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/bendangerzone/image/upload/v1612391979/Dev.to/pexels-photo-207662_s8yd00.jpg" alt="A filled bookshelf"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Similar to the topic above, this section of the exam will be taking a deeper dive on the non-relational or NoSQL services available to you on Azure. &lt;/p&gt;

&lt;p&gt;The exam will ask you to recognize the traits of NoSQL data and how it differs from relational data. You'll be asked to identify types of data and sort it into NoSQL or relational buckets.&lt;/p&gt;

&lt;p&gt;On top of that you will need to know about the various Azure data service offerings for non-relational data and identify their use-cases and differences. Types of non-relational structures will be addressed such as key-value, graph, tree, and others. You will also need to know about Azure Table, Blob, and Files and what specific needs they address.&lt;/p&gt;

&lt;p&gt;Finally you'll also need to understand the same management and connectivity topics about Azure's non-relational stores as you did about the relational data services.&lt;/p&gt;

&lt;h2&gt;
  
  
  Describe an analytics workload on Azure
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4qVU37PR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/bendangerzone/image/upload/v1612392413/Dev.to/pexels-photo-185576_p5tvtp.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4qVU37PR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/bendangerzone/image/upload/v1612392413/Dev.to/pexels-photo-185576_p5tvtp.jpg" alt="Analytics"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I found this final section on analytics to be the most product-centric questions of the exam. While many of the data storage options are somewhat platform agnostic (MySQL can run on any number of cloud providers, for example) the analytics tools are very specific to Microsoft Azure.&lt;/p&gt;

&lt;p&gt;You need to know the pipeline of data processing from ingestion through OLTP storage, ETL, and warehousing or data lake storage. Yes you'll need to know what OLTP is and how it differs from OLAP. You'll also need to understand the role of Azure Synapse Analytics, Azure Data Factory, Azure Data Lake, Azure HDInsight, and Databricks. While each of these tools may have some overlap they also serve their own specific purposes in a data stream pipeline.&lt;/p&gt;

&lt;p&gt;Finally you'll be expected to have worked with and understand how PowerBI is used to provide various chart, graph, and dashboards for analytics. Know what a PowerBI workflow looks like and how you can leverage it against the previously mentioned data stores.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;The DP-900 exam is not a difficult test. It doesn't require in-depth technical knowledge, there are no fill-in-the-blank coding challenges, and you won't have to dive too deeply into any one technology. However it is a broad exam that covers a wide variety of topics across the entire Azure data platform so prepare yourself accordingly.&lt;/p&gt;

&lt;p&gt;Good luck!&lt;/p&gt;

</description>
      <category>azure</category>
      <category>database</category>
      <category>cloud</category>
      <category>certifications</category>
    </item>
    <item>
      <title>But Which Programming Language Should I Learn?!</title>
      <dc:creator>Benjamin Finkel</dc:creator>
      <pubDate>Sat, 07 Mar 2020 16:08:50 +0000</pubDate>
      <link>https://dev.to/benfinkel/but-which-programming-language-should-i-learn-3go2</link>
      <guid>https://dev.to/benfinkel/but-which-programming-language-should-i-learn-3go2</guid>
      <description>&lt;p&gt;&lt;em&gt;Each week I'll be combing through the #HelpMeCode hashtag on Twitter and looking for questions that I believe I can help answer and would benefit from a deeper dive than the Twitter platform offers.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Today's Tweet:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Liquid error: internal&lt;/p&gt;

&lt;p&gt;My post today is in response to a query from &lt;a href="https://twitter.com/kylezollo"&gt;@KyleZollo&lt;/a&gt;. He posted a poll asking for input on which programming language he should learn next, and had some follow-up questions about his results.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Pretty interesting split in this poll. I’m aware that Java is one of the more popular languages. Not totally sure where Go is used (containers? Advanced web dev?) Would anyone care to enlighten me?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;It's a great question Kyle! You're certainly not the first person in technology to wonder where to focus your time and energy for learning. We all want to make sure that what we're learning has value to employers, customers, and ourselves. Even after 24 years in this business, my career with CBT Nuggets forces me to ask this question routinely. After all what good is my training if I'm not learning and teaching the valuable stuff that people want to know?&lt;/p&gt;

&lt;p&gt;But IT is an enormous field. Even in our subset of IT, as programmers, the choices are varied and wide-spread. Do we focus on front end technologies like &lt;a href="https://reactjs.org/"&gt;React&lt;/a&gt; and &lt;a href="https://redux.js.org/"&gt;Redux&lt;/a&gt;? Or should we bone up on the back end languages such as &lt;a href="https://nodejs.org/en/"&gt;Node&lt;/a&gt;, or &lt;a href="https://www.php.net/"&gt;PHP&lt;/a&gt;, or &lt;a href="https://docs.microsoft.com/en-us/dotnet/csharp/"&gt;C#&lt;/a&gt;? Maybe we need to understand better how to work with a database and leverage the power of &lt;a href="https://www.sqlalchemy.org/"&gt;SQL Alchemy&lt;/a&gt; or &lt;a href="https://www.fullstackpython.com/django-orm.html"&gt;Django ORM&lt;/a&gt;? It's enough to send your head spinning!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Xn2D9kpl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://res.cloudinary.com/benfinkelcbt/image/upload/v1583594213/devto/spinninghead_bsxdnb.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Xn2D9kpl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://res.cloudinary.com/benfinkelcbt/image/upload/v1583594213/devto/spinninghead_bsxdnb.gif" alt="Spinning Head"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There's certainly no easy way to answer a question like this, but I believe Kyle cuts right to the heart of a good approach in his query. When Kyle asks &lt;strong&gt;what&lt;/strong&gt; the applications for a language like Go are, he's framing his question in a much more answerable way. By identifying a use-case.&lt;/p&gt;

&lt;p&gt;Defining learning goals in technology should not be about learning a given language. I can spend ten minutes and write an If-Then-Else statement in a dozen different languages, but it's not clear what value that would add to anyone. Instead I choose to define my goals by output. What do I want to accomplish? What tasks can I perform? What's a problem to solve? &lt;/p&gt;

&lt;p&gt;It's only with an end project in mind that we are ready to explore the underlying technology that goes into it. The question isn't "Should I learn Go?" but rather "I want to implement a high performing Pub/Sub server on a public cloud service. What do I need to do that?" By answering that second question you may find that Go is the right choice. Or you may not! You'll research the technologies that accomplish your goal and learn how to leverage that research into achieving that goal.&lt;/p&gt;

&lt;p&gt;At the end of the day your &lt;strong&gt;most valuable asset as a developer&lt;/strong&gt; is not what you know, but your confidence in &lt;strong&gt;your ability to learn what's needed&lt;/strong&gt; for any given project. Understanding this will make your journey through IT interesting and successful and, just maybe, fun!&lt;/p&gt;




&lt;p&gt;*Find all of Ben's training content here, at CBT Nuggets - &lt;a href="http://learn.gg/ben-finkel"&gt;http://learn.gg/ben-finkel&lt;/a&gt; *&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>healthydebate</category>
    </item>
    <item>
      <title>When Do We Want to Use a Static Class?</title>
      <dc:creator>Benjamin Finkel</dc:creator>
      <pubDate>Fri, 28 Feb 2020 22:36:50 +0000</pubDate>
      <link>https://dev.to/benfinkel/when-do-we-want-to-use-a-static-class-2n10</link>
      <guid>https://dev.to/benfinkel/when-do-we-want-to-use-a-static-class-2n10</guid>
      <description>&lt;p&gt;&lt;em&gt;Each week I'll be combing through the #HelpMeCode hashtag on Twitter and looking for questions that I believe I can help answer and would benefit from a deeper dive than the Twitter platform offers.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Today's Tweet:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Liquid error: internal&lt;/p&gt;

&lt;p&gt;My post today is in response to a query from &lt;a href="https://twitter.com/rforjoe"&gt;@rforjoe&lt;/a&gt;. He is wondering how to access the methods in a class from classes in another package in Java.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Hi, so struggling to get my head around this. If I have classes (pages)and i create a class (MenuNavigation) in another package which contains methods I want all the classes to have access to. What do I do?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Great question Richard! There's really two possible answers, and we'll explore both here.&lt;/p&gt;

&lt;p&gt;The first way, to simply address the question you asked head on: How do I call all of those methods from classes that are in a different package? It's easy enough to do. We need to import that class (MenuNavigation) into the classes that we wish to call them from.  After we've done that we can instantiate a new instance of MenuNavigation and execute it's methods.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2Go1CFd_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/benfinkelcbt/image/upload/v1582928906/devto/java_1_accv7y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2Go1CFd_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/benfinkelcbt/image/upload/v1582928906/devto/java_1_accv7y.png" alt="Importing a Class From a Different Package"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note that the import statement requires a slight addition. Namely, we have to refer to the remote class by a fully qualified name. We include the Package name in the import statement like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;Actions.MenuNavigation&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Later in the twitter thread user &lt;a href="https://twitter.com/Duiker101"&gt;@Duiker101&lt;/a&gt; identifies that the class structure as displayed may well be suited for a Static class implementation. But what exactly &lt;strong&gt;is&lt;/strong&gt; as static class and when should you use one?&lt;/p&gt;

&lt;p&gt;Put as simply as possible: A Static class is a class that does not need to be instantiated. This might fly in the face of what you know about Object-Oriented Programming.  After all, don't ALL classes need to be instantiated to an object before they can be used?  I certainly did in my example above. The line&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;MenuNavigation&lt;/span&gt; &lt;span class="n"&gt;nav&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;MenuNavigation&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Does exactly that. It creates a new instance of the MenuNavigation class and assigns that instance to the 'nav' variable. What is a class without an instance anyways? I often describe Classes like architectural blueprints. They describe how to build a house, but you can't live in one.&lt;/p&gt;

&lt;p&gt;Sometimes we don't want multiple copies of our instances out there. Or we don't want the possibility of accidentally creating multiple copies. As an example consider a class of Configuration variables. It might read values from a file when the program is first launched. It might also re-read updated values at various points during the execution of our program. With a typical setup we would have to instantiate that class before we could load values into it which means we have the potential problems of both destroying it before we're done with it, thus losing our values, or creating multiple instances of it with different values. Yikes!&lt;/p&gt;

&lt;p&gt;With a Static class there is actually one, and only one, instance of our class created. It's done behind the scenes without our involvement, and it allows us to access the class methods and properties without every instantiating it again. We don't have to worry about destroying that instance too early, because we can't! This solution is ideal for Richard's configuration above as well. Assuming the Navigation Menu is loaded once when the program launches and never changes it's functionality then it's a good candidate for a Static class.&lt;/p&gt;

&lt;p&gt;Declaration for a Static class in Java is a little more complex. It cannot be a "root-level" class, it must be a sub-class. So for Richard's example I've modified it to have a main class named 'Menu' defined as a public class. My Static class is a sub-class of that root-level class defined with the 'static' keyword. The methods I wish to access must also have the static keyword in their definitions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rAXo8uRo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/benfinkelcbt/image/upload/v1582928906/devto/java_2_x0nutr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rAXo8uRo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/benfinkelcbt/image/upload/v1582928906/devto/java_2_x0nutr.png" alt="Declaring a Static Class in Java"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Having done that, I can now reference the MenuNavigation class in my HomePage class without the instantiation. When this program executes Java will create the instance for me and manage it and make it available when it's requested.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ta7Y1gON--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/benfinkelcbt/image/upload/v1582928906/devto/java_3_vie4zb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ta7Y1gON--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/benfinkelcbt/image/upload/v1582928906/devto/java_3_vie4zb.png" alt="Using a Static Class Without Instantiating it"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So that is how and where you might use a Static class in Java. Bear in mind this applies across any OOP language that supports Static classes including C#. &lt;/p&gt;




&lt;p&gt;*Find all of Ben's training content here, at CBT Nuggets - &lt;a href="http://learn.gg/ben-finkel"&gt;http://learn.gg/ben-finkel&lt;/a&gt; *&lt;/p&gt;

</description>
      <category>oop</category>
      <category>java</category>
    </item>
    <item>
      <title>Embracing the Power of the Self-Referential Join</title>
      <dc:creator>Benjamin Finkel</dc:creator>
      <pubDate>Fri, 21 Feb 2020 21:37:04 +0000</pubDate>
      <link>https://dev.to/benfinkel/embracing-the-power-of-the-self-referential-join-6nl</link>
      <guid>https://dev.to/benfinkel/embracing-the-power-of-the-self-referential-join-6nl</guid>
      <description>&lt;p&gt;&lt;em&gt;Each week I'll be combing through the #HelpMeCode hashtag on Twitter and looking for questions that I believe I can help answer and would benefit from a deeper dive than the Twitter platform offers.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Today's Tweet:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Liquid error: internal&lt;/p&gt;

&lt;p&gt;My post today is in response to a query from &lt;a href="https://twitter.com/AudTheCodeWitch"&gt;@AudTheCodeWitch&lt;/a&gt;.  She has a specific question about a fairly common relational database structure&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Ok #helpmecode, I'm working on structuring the database for a classroom library app. A User is either a Student OR a Teacher, and a Student belongs to a Teacher. I think I need a joining table, but I'm getting confused. Any help?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Database Normalization and SQL helps us understand how to structure our tables and define the relationships between them. When we're learning the examples chosen are usually straightforward to explain and understand.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://support.airtable.com/hc/en-us/articles/218734758-A-beginner-s-guide-to-many-to-many-relationships#onetomany"&gt;This example, from Airtable&lt;/a&gt;, uses Museums and Works to demonstrate how one Museum may "own" many Works but any given Work will always belong to one and only one Museum. This is known as a "One-to-Many" relationship (one Museum, many Works) and conventions of Normalization and database design give us clues on how to organize our database objects to support this data.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--s6yE1kRx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/benfinkelcbt/image/upload/v1582241907/devto/onetomany_gahzrb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--s6yE1kRx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/benfinkelcbt/image/upload/v1582241907/devto/onetomany_gahzrb.png" alt="One-to-Many Database Schema"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From there you might imagine that, for any given Work, there are one or more Creators. And Creators certainly can have more than one Work. This is a "Many-to-Many" relationship, and there are conventions for how to efficiently store and retrieve data like this as well.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iErevsut--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/benfinkelcbt/image/upload/v1582242490/devto/manytomany_bgsntm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iErevsut--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/benfinkelcbt/image/upload/v1582242490/devto/manytomany_bgsntm.png" alt="Many-to-Many Database Schema"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But &lt;a href="https://twitter.com/AudTheCodeWitch"&gt;AudTheCodeWitch&lt;/a&gt; raises an interesting question! What happens when that relationship becomes self-referential? Her example, of Students and Teachers, is a good one. They're both "Users" in her system, and outside of the Student/Teacher distinction there isn't any difference. Another common example of this structure is Employees and Managers.  Employees are often also Managers, and may even have their own Manager as well. It's a very circular style.&lt;/p&gt;

&lt;p&gt;When modeling this structure in OOP the answer is a little easier. You'd have your User class, and from that inherit both Students and Teachers. But what's the right way to model this in a Normalized relational database?&lt;/p&gt;

&lt;p&gt;Self-referencing joins! There is no reason why the "foreign" key in a table cannot refer back to the key of the same table it's stored in. This allows us to maintain normalization and, in my opinion, does not detract from the legibility of the table structure. It's also perfectly valid for either one-to-many or many-to-many relationships.&lt;/p&gt;

&lt;p&gt;To continue with AudTheCodeWitch's example, in her Twitter thread she indicates that she initially imagined that each student could have one and only one teacher. Sound familiar? That's the description of a one-to-many relationship. While she certainly could have two separate tables, the simpler solution is to simply have a field in the Users table that is a FK to the Id of that same Users table. It could be named "TeacherUserId" and would be populated for any User object that had a teacher.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wHqdYRWd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/benfinkelcbt/image/upload/v1582246374/devto/selfref1_w5aryt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wHqdYRWd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/benfinkelcbt/image/upload/v1582246374/devto/selfref1_w5aryt.png" alt="A self-referential One-to-Many relationship"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this model the one-to-many relationship is modeled perfectly and without any additional database entities. It's also clear, from a glance, which Users are Students (they'll have a value in the TeacherUserId field!)&lt;/p&gt;

&lt;p&gt;On top of that, it can model recursive references without any changes. If we're using it for Employees and Managers instead, each record can both have it's ManagerUserId field filled in, as well as having it's Id in another record's ManagerUserId.&lt;/p&gt;

&lt;p&gt;AudTheCodeWitch does acknowledge that she could imagine a scenario where a Student has more than one teacher. That makes sense, Students often have multiple classes with multiple teachers.  The self-referential join is still valid even though we're now looking at a many-to-many relationship. Just like a traditional many-to-many relationship we would model this with an intermediary table.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DOFKLVq9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/benfinkelcbt/image/upload/v1582247022/devto/selfref2_xcweer.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DOFKLVq9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/benfinkelcbt/image/upload/v1582247022/devto/selfref2_xcweer.png" alt="A self-referential Many-To-Many relationship"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This adds an additional mapping table, but all normalized many-to-many relationships do. And it is still fairly self-documenting.&lt;/p&gt;

&lt;p&gt;So there you have it, the self-referential join in all it's glory. Not so scary and immediately useful for a variety of scenarios.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Bonus Info&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Querying this model is no more difficult than any other, it just requires thoughtful use of aliases.  A sample query for the one-to-many implementation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; 
   &lt;span class="n"&gt;S&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Name&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;StudentName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
   &lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Name&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;TeacherName&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt;
   &lt;span class="n"&gt;Users&lt;/span&gt; &lt;span class="n"&gt;S&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;Users&lt;/span&gt; &lt;span class="n"&gt;T&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;S&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;TeacherUserId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Id&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;*Find all of Ben's training content here, at CBT Nuggets - &lt;a href="http://learn.gg/ben-finkel"&gt;http://learn.gg/ben-finkel&lt;/a&gt; *&lt;/p&gt;

</description>
      <category>sql</category>
      <category>database</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
