{"id":4085,"date":"2023-06-23T18:53:57","date_gmt":"2023-06-23T21:53:57","guid":{"rendered":"https:\/\/nocodestartup.io\/?p=4085"},"modified":"2025-10-28T15:48:09","modified_gmt":"2025-10-28T18:48:09","slug":"sql-data-modeling-2","status":"publish","type":"post","link":"https:\/\/nocodestartup.io\/en\/sql-data-modeling-2\/","title":{"rendered":"Data Modeling and SQL | Beginner&#039;s Guide"},"content":{"rendered":"<h2 class=\"wp-block-heading\" id=\"h-introducao-a-modelagem-de-dados\">Introduction to Data Modeling<\/h2>\n\n\n\n<p>Certainly the subject of Data Modeling and SQL is one of the most important topics when we want to develop robust systems or applications.<\/p>\n\n\n\n<p>Structuring your application&#039;s SQL data modeling can make all the difference in the future, saving work and bringing a lot of performance and scalability.<\/p>\n\n\n\n<p>This Data Modeling and SQL content will explain the most important database fundamentals and present a step-by-step methodology to structure your business data and turn it into an application. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-veja-o-conteudo-completo-em-video-aqui\">Watch the full video content here: <\/h3>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"Data Modeling and SQL Course | Beginner&#039;s Guide\" width=\"800\" height=\"450\" src=\"https:\/\/www.youtube.com\/embed\/SEnnucNP1h0?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-o-que-voce-aprendera\">What will you learn?<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Fundamentals of Data Modeling and SQL<\/li>\n\n\n\n<li>Methodology how to model your database<\/li>\n\n\n\n<li>Conceptual, Logical and Physical Model in practice<\/li>\n\n\n\n<li>How to create an application from your database model <\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-fundamentos-de-banco-de-dados\">Database Fundamentals<\/h2>\n\n\n\n<p>Before we get into the subject of Databases, you need to understand some important concepts:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Die: A value in its individual form<\/li>\n\n\n\n<li>Database: Set of data organized and related to each other <\/li>\n\n\n\n<li>Information: Important insights from a database that helps strategic decisions\n<ul class=\"wp-block-list\">\n<li>How many courses did you sell in the month?&nbsp;<\/li>\n\n\n\n<li>What are the best months of the year for sales?<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>In order to manage and manipulate data in a system, we generally use a Database Management System, the most famous of which are: <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>mysql<\/li>\n\n\n\n<li>NoSQL<\/li>\n\n\n\n<li>MongoDB<\/li>\n\n\n\n<li>firebase<\/li>\n<\/ul>\n\n\n\n<p>To understand the difference between them, you need to understand what Relational Databases are and what SQL is.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-bancos-de-dados-relacionais-e-sql\">Relational Databases and SQL<\/h2>\n\n\n\n<p>Relational databases are databases that store and manipulate data related to each other.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql2-1024x576.jpg\" alt=\"Relational Databases and SQL\" class=\"wp-image-4099\" style=\"width:840px;height:472px\" srcset=\"https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql2-1024x576.jpg 1024w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql2-768x432.jpg 768w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql2-18x10.jpg 18w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql2.jpg 1280w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Tables are usually connected via primary and foreign key. The Primary Key (PK) is the identifier of that record in the table, and must be unique. <\/p>\n\n\n\n<p>The foreign key (Foreign Key \u2013 FK) is the primary key of another table, so we can connect the data.<\/p>\n\n\n\n<p>The most famous databases on the market are PostgreSQL, MySQL and SQLite.<\/p>\n\n\n\n<p>To manipulate the information in the database we use SQL, which is how we do queries in our database.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"469\" src=\"https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dadis-sql5-1024x469.png\" alt=\"What is SQL relational database?\" class=\"wp-image-4110\" srcset=\"https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dadis-sql5-1024x469.png 1024w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dadis-sql5-768x352.png 768w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dadis-sql5-1536x703.png 1536w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dadis-sql5-18x8.png 18w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dadis-sql5.png 1738w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-bancos-de-dados-nao-relacionais-e-nosql\">Non-Relational Databases and NoSQL<\/h2>\n\n\n\n<p><a href=\"https:\/\/aws.amazon.com\/pt\/nosql\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">NoSQL stands for Not Only SQL<\/a>, which shows that NoSQL databases may or may not have relationships.<\/p>\n\n\n\n<p>There are several ways to structure our data:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>document and collection<\/li>\n\n\n\n<li>Graphs<\/li>\n\n\n\n<li>Key Value<\/li>\n\n\n\n<li>Columnar<\/li>\n<\/ul>\n\n\n\n<p>Our focus will be document and collection.. where we store data in \u201cfolders\u201d which are collections and \u201cdocuments\u201d which are records.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"510\" src=\"https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados8-1024x510.png\" alt=\"What characteristic defines NoSQL non-relational databases?\" class=\"wp-image-4116\" srcset=\"https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados8-1024x510.png 1024w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados8-768x382.png 768w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados8-1536x764.png 1536w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados8-18x9.png 18w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados8.png 1724w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>The main NoSQL databases on the market are MongoDB, Firebase and Cassandra.<\/p>\n\n\n\n<p>The focus of this content will be on SQL, see our NoSQL data modeling content later.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-metodologia-para-modelagem-de-dados\">Methodology for Data Modeling<\/h2>\n\n\n\n<p>To perform data modeling from scratch, you need to follow these steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Requirements gathering;<\/li>\n\n\n\n<li>Conceptual Model;<\/li>\n\n\n\n<li>Logical Model&#039;<\/li>\n\n\n\n<li>Physical Model.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"564\" src=\"https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dado-sql6-1024x564.png\" alt=\"How to perform data modeling?\" class=\"wp-image-4111\" srcset=\"https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dado-sql6-1024x564.png 1024w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dado-sql6-768x423.png 768w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dado-sql6-1536x847.png 1536w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dado-sql6-18x10.png 18w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dado-sql6.png 1778w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>In the requirements analysis stage, a survey is carried out of all the functionalities that the software will do, all of which must be aligned according to the end user&#039;s vision.<\/p>\n\n\n\n<p>In this data modeling content, it will not be the focus to explain the requirements gathering part, but it could be a future class here.<\/p>\n\n\n\n<p>Let&#039;s start?<\/p>\n\n\n\n<p>Let&#039;s start with the conceptual model!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-etapa-1-modelagem-de-dados-modelo-conceitual\">Step 1 Data Modeling \u2013 Conceptual Model<\/h2>\n\n\n\n<p>To carry out the database modeling, we will use the case of No-Code Start-Up as an example, here in our community we have our Training (courses) and students can purchase these courses. <\/p>\n\n\n\n<p>Let&#039;s understand how to model?<\/p>\n\n\n\n<p>The first stage is the Conceptual Model, where we understand the general concept of the business and what will be the main data involved. We will take the following actions:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Define Entities<\/li>\n\n\n\n<li>Set Attributes<\/li>\n\n\n\n<li>Define Relationships<\/li>\n\n\n\n<li>Build Final Conceptual Model - Entity Relationship Diagram (ERD)<\/li>\n<\/ol>\n\n\n\n<p>The entities are all the main tables involved, such as \u201cStudents\u201d, \u201cCourses\u201d and \u201cSales\u201d. The attributes are the fields that we will have in these tables, the design will look like this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"502\" src=\"https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql3-1024x502.png\" alt=\"What is the conceptual data modeling model?\" class=\"wp-image-4107\" srcset=\"https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql3-1024x502.png 1024w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql3-768x377.png 768w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql3-1536x754.png 1536w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql3-18x9.png 18w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql3.png 1806w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>From there we can define how the entities are related, for that we have some options:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>1 to 1 relationship <\/li>\n\n\n\n<li>1 to Many Ratio<\/li>\n\n\n\n<li>Many to Many Relationship<\/li>\n<\/ul>\n\n\n\n<p>See some examples<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"465\" src=\"https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql4-1024x465.png\" alt=\"What are the steps in data modeling?\" class=\"wp-image-4108\" srcset=\"https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql4-1024x465.png 1024w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql4-768x348.png 768w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql4-1536x697.png 1536w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql4-18x8.png 18w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql4.png 1622w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Thus, our final conceptual model will look like this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"433\" src=\"https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql5-1024x433.png\" alt=\"What are conceptual data models?\" class=\"wp-image-4109\" srcset=\"https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql5-1024x433.png 1024w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql5-768x325.png 768w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql5-1536x649.png 1536w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql5-18x8.png 18w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql5.png 1864w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-etapa-2-modelagem-de-dados-modelo-logico\">Step 2 Data Modeling \u2013 Logical Model<\/h2>\n\n\n\n<p>In the Logical Model, we will further detail the entities and attributes. We will also design the schemas and their relationships.<\/p>\n\n\n\n<p>Before proceeding, we need to ensure that we are in accordance with the 3 Normal Forms.<\/p>\n\n\n\n<p>Normalization is the optimization we perform on tables to reduce data redundancy, duplication and inconsistency.&nbsp;<\/p>\n\n\n\n<p>This way we can have a more consistent, organized and better performing data model.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>NF1 \u2013 The table must have only unique attributes, there cannot be multivalued attributes.<\/li>\n\n\n\n<li>NF2 \u2013 Attributes (non-key) depend only on the primary key<\/li>\n\n\n\n<li>NF3 \u2013 Attributes (non-key) must be independent of each other<\/li>\n<\/ul>\n\n\n\n<p>Watch the YouTube video on data modeling to understand with real examples.<\/p>\n\n\n\n<p>From data normalization, we can proceed to the design of schemas and their relationships. The final drawing will look like this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"394\" src=\"https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql6-1024x394.png\" alt=\"What is logical data model?\" class=\"wp-image-4112\" srcset=\"https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql6-1024x394.png 1024w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql6-768x296.png 768w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql6-1536x592.png 1536w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql6-18x7.png 18w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql6.png 1932w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-etapa-3-modelagem-de-dados-modelo-fisico\">Step 3 Data Modeling \u2013 Physical Model<\/h2>\n\n\n\n<p>Step 3 is where we bring our data modeling to life, we must choose one of the DBMS on the market to create our database. It consists of 3 actions:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Choice of DBMS Technology<\/li>\n\n\n\n<li>Create database with SQL<\/li>\n\n\n\n<li>Bank management and maintenance<\/li>\n<\/ol>\n\n\n\n<p>We will create all tables from SQL.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"540\" src=\"https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql7-1024x540.png\" alt=\"What are the 3 types of data modeling?\" class=\"wp-image-4113\" srcset=\"https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql7-1024x540.png 1024w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql7-768x405.png 768w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql7-1536x809.png 1536w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql7-18x9.png 18w, https:\/\/nocodestartup.io\/wp-content\/uploads\/2023\/06\/modelagem-de-dados-sql7.png 1560w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-finalizacao\">Finalization<\/h2>\n\n\n\n<p>I hope you enjoyed this data modeling content, for more details see our full video where we create an app from our ready-made database. The created application is made in 100% without programming, with <a href=\"https:\/\/nocodestartup.io\/en\/bubble\/\" target=\"_blank\" rel=\"noreferrer noopener\">Bubble<\/a>.<\/p>\n\n\n\n<p>If you want to know more about the nocode world, understand <a href=\"https:\/\/nocodestartup.io\/en\/how-to-create-an-app-2\/\" target=\"_blank\" rel=\"noreferrer noopener\">how to create an application without code.<\/a><\/p>\n\n\n\n<p>To the next!<\/p>\n\n\n\n<p>Matheus Castelo<\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p><strong>No-code Startup Course:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/flix.nocodestartup.io\/m\/c\/modelagem-de-dados-sql-flutterflow\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">SQL Data Modeling \u2013 FlutterFlow<\/a><\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>Introduction to Data Modeling The subject of Data Modeling and SQL is certainly one of the most important topics when we want to develop robust systems or applications. Structuring the SQL data modeling of your application can make all the difference in the future, saving work and bringing a lot of performance and scalability. This content [\u2026]<\/p>","protected":false},"author":3,"featured_media":4089,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"post_folder":[],"class_list":["post-4085","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-no-code"],"acf":[],"_links":{"self":[{"href":"https:\/\/nocodestartup.io\/en\/wp-json\/wp\/v2\/posts\/4085","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nocodestartup.io\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nocodestartup.io\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nocodestartup.io\/en\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/nocodestartup.io\/en\/wp-json\/wp\/v2\/comments?post=4085"}],"version-history":[{"count":0,"href":"https:\/\/nocodestartup.io\/en\/wp-json\/wp\/v2\/posts\/4085\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nocodestartup.io\/en\/wp-json\/wp\/v2\/media\/4089"}],"wp:attachment":[{"href":"https:\/\/nocodestartup.io\/en\/wp-json\/wp\/v2\/media?parent=4085"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nocodestartup.io\/en\/wp-json\/wp\/v2\/categories?post=4085"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nocodestartup.io\/en\/wp-json\/wp\/v2\/tags?post=4085"},{"taxonomy":"post_folder","embeddable":true,"href":"https:\/\/nocodestartup.io\/en\/wp-json\/wp\/v2\/post_folder?post=4085"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}