<?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>Forem: Fernanda Fernandes </title>
    <description>The latest articles on Forem by Fernanda Fernandes  (@fernandafmsf).</description>
    <link>https://forem.com/fernandafmsf</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%2F1148427%2F1e219427-b0f7-4c36-bce7-c2eaca86471d.jpeg</url>
      <title>Forem: Fernanda Fernandes </title>
      <link>https://forem.com/fernandafmsf</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/fernandafmsf"/>
    <language>en</language>
    <item>
      <title>Database for newbies: Hands On</title>
      <dc:creator>Fernanda Fernandes </dc:creator>
      <pubDate>Tue, 26 Mar 2024 18:00:00 +0000</pubDate>
      <link>https://forem.com/basementdevs/database-for-newbies-3a9f</link>
      <guid>https://forem.com/basementdevs/database-for-newbies-3a9f</guid>
      <description>&lt;p&gt;Knowing how to deal with databases are &lt;strong&gt;really&lt;/strong&gt; important for every developer, so I will guide you through a tutorial on how to create one using MySQL on the terminal. &lt;/p&gt;

&lt;p&gt;If you are a little bit lost when it comes to databases, I highly recommend you my first article of this series, where I explain the theory about databases. For now, lets get to the pratical part! &lt;/p&gt;

&lt;h2&gt;
  
  
  Table of contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Hands on!&lt;/li&gt;
&lt;li&gt;Preparing the environent&lt;/li&gt;
&lt;li&gt;
Creating our first database

&lt;ul&gt;
&lt;li&gt;Datatypes and properties&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
CRUD

&lt;ul&gt;
&lt;li&gt;Create&lt;/li&gt;
&lt;li&gt;Read&lt;/li&gt;
&lt;li&gt;Update&lt;/li&gt;
&lt;li&gt;Delete&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Hands on!
&lt;/h2&gt;

&lt;p&gt;There are many ways of creating a database, but I usually do it using MySQL on the terminal and DBeaver to visualize them when I need it. I decided to approach only MySQL on the terminal, specially because it is pretty simple to learn and very important to know the basics.  Maybe one day I can show how DBeaver works. For now, I will show you how to deal with database through terminal, but remember - there are different ways of doing it. &lt;/p&gt;

&lt;h2&gt;
  
  
  Preparing the environment
&lt;/h2&gt;

&lt;p&gt;First of all, you will have to install MySQL. I recommend you to install the MySQL Installer, which will have a lot of softwares to be downloaded, such as MySQL Workbench, MySQL Shell and many others. You should be able to download it on this link &lt;a href="https://dev.mysql.com/downloads/installer/"&gt;MySQL Installer&lt;/a&gt; and run the program. Then you should install MySQL Server, MySQL Workbench and MySQL Shell. &lt;/p&gt;

&lt;p&gt;If you use other operational system than windows, or is having some issues you can ask me or try to take a look on some videos or articles more focused on the step-to-step installation. &lt;/p&gt;

&lt;p&gt;After doing it, you will have to define the windows variable system. You should go on System's propriety&amp;gt;Advanced and then Environment variables&lt;/p&gt;

&lt;p&gt;Find the system variable called "Path" and double click it. Then you should click on "New" and copy the MySQL server's path on it. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbiq7t02a6hqk3t4r3plk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbiq7t02a6hqk3t4r3plk.png" alt="SQL path variable" width="363" height="23"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To test if it is working, open the terminal ( command prompt ) and type&lt;code&gt;mysql&lt;/code&gt;. If an error saying that you have no access shows up, try te command &lt;code&gt;mysql -h localhost  -u root -p&lt;/code&gt;. It will ask the password and it will connect on MySQL. &lt;/p&gt;

&lt;h2&gt;
  
  
  Creating our first database
&lt;/h2&gt;

&lt;p&gt;Now that we had set up our environment, we can work on the database! First of all, since we are going to do it using the terminal, you will have to open it and then connect on MySQL, which can be done with &lt;code&gt;mysql&lt;/code&gt; command or &lt;code&gt;mysql -h localhost  -u root -p&lt;/code&gt;.  You should be able to see something similar to the picture below.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Important&lt;/strong&gt;: every MySQL command must finish with ";", and it is a good practice to write it on capital letters. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxre2jtfzshx6hojr2y5n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxre2jtfzshx6hojr2y5n.png" alt="SQL connection on terminal" width="729" height="321"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After that, it is important to acknowledge some important database commands, such as: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;CREATE DATABASE &amp;lt;database-name&amp;gt;;&lt;/code&gt; : creates the database with the name specified on "database-name";&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;SHOW DATABASES;&lt;/code&gt; : shows the databases created; &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;DROP DATABASE &amp;lt;database-name&amp;gt;&lt;/code&gt; : delete the database informed and its values;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;USE &amp;lt;database-name&amp;gt;&lt;/code&gt;: to select the database and be able to work on it. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now the idea is to create a database named "store" and then a table named "products", which will have the fields id (the primary key), name, price and quantity.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcrj1svxw2yux135xi1og.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcrj1svxw2yux135xi1og.png" alt="Products table" width="220" height="158"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To create this database we will use the command on the terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE DATABASE store; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After creating it, we will create the table named "products". We must select and enter the database first and then create the table with its fields, which will be id, name, price and quantity.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;USE store; //Selecting the database
CREATE TABLE products
    ( id int auto_increment primary key,
      name varchar(40) NOT NULL, 
      price double(10,2) NOT NULL,
      quantity int NOT NULL
    );  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ok, now we have our database and our first table created! To visualize it we can use &lt;code&gt;SHOW DATABASES;&lt;/code&gt; or &lt;code&gt;SHOW TABLES;&lt;/code&gt; to see the tables created. We can also use &lt;code&gt;DESCRIBE products;&lt;/code&gt; if we want to see the table's description.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F345ws57g8fmvpf1leejw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F345ws57g8fmvpf1leejw.png" alt="Description of products table on the terminal" width="664" height="206"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Datatypes and Properties
&lt;/h3&gt;

&lt;p&gt;Every time we create a table, we have to define the type of our data and some properties like if it is a primary key, a foreign key, if the data can be null, if it is unique... There are many properties and datatypes so We can use what will fit us the best. &lt;/p&gt;

&lt;p&gt;One of the most common datatypes are: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Int&lt;/strong&gt; : used for integer numbers, allows 4 bytes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Double&lt;/strong&gt;: float number with double precision&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Decimal(p,s)&lt;/strong&gt; :  used to store decimal numbers. "p" defines how many numbers will be allowed on the left side of the comma. "s" defines how many will be allowed on the right side of the comma. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Date&lt;/strong&gt; : stores a date, which can be from 01/01/0001 to 12/31/9999.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Timestamp&lt;/strong&gt; : stores an unique number that will be updated every time a table line is updated or created. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Varchar(n)&lt;/strong&gt; : stores characters. "n" shows that we can define the amount of characters we are expecting to receive. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The properties are really important for our database, it will gives us more details. One of the most common ones are: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Not null&lt;/strong&gt; : when applied to the data, means it can not be null, so it has to be given an value. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Auto_increment&lt;/strong&gt;: mostly applied to primary keys, allows automatic generation of unique numerical values for a columns. Very used to create unique indentifiers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Primary key&lt;/strong&gt;: property used to define the data as primary key of the table
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Foreign key&lt;/strong&gt; :  property used to define the data as foreign key of the table, creating a relationship between tables. &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  CRUD
&lt;/h2&gt;

&lt;p&gt;After learning all of this about database, we can finally get to create a CRUD on the database. CRUD means create, read, update and delete, and it is really important for every developer, especially the back-end ones, to know how to do it. &lt;/p&gt;

&lt;p&gt;In real life, CRUD is made using a programming language to get the data sent and store on the database. However, you need to know the SQL commands used to manipulate a database because even though you are going to use PHP, Java, Node or Python to do it, you probably will have to use the same SQL commands. After this article I will write another one creating a PHP application to show you how it works!&lt;/p&gt;

&lt;p&gt;I highly recommend that you do these steps on your terminal to see how MySQL works! And, of course, feel free to try new things.&lt;/p&gt;

&lt;h3&gt;
  
  
  Create
&lt;/h3&gt;

&lt;p&gt;To create or insert a data on our table we use the command &lt;code&gt;INSERT INTO&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;INSERT INTO products VALUES (null, 'Rice', 5, 10); //One way of doing it 
INSERT INTO products (name, price, quantity) VALUES ('Rice', 5, 10); //Another way of inserting data 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the first option is important to understand that the values informed must be at the same sequence of the table (id, name, price and quantity). The id can be null because it is an auto_increment data. And in the second option we inform which datas will be given. Also every time we insert a string, we have to use quotes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Read
&lt;/h3&gt;

&lt;p&gt;To read information of a table we use the command &lt;code&gt;SELECT&lt;/code&gt; . There is some ways of selecting information.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT * FROM products; //Example 1
SELECT * FROM products WHERE id = 1; //Example 2  
SELECT (name) FROM products WHERE quantity&amp;lt;5; //Example 3 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;We use ' * ' to say that we want to read all the fields - or columns - of the table, just like example 1. If we do not want it, we can inform which ones we want, like example 3.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We use the clause " WHERE " to filter the information we want to return. For example if we wanted to know which product holds the id equals to number 1, we would use the example 2. It is also possible to use the 'where' to return the products that has less than 5 quantities, just as in example 3. &lt;strong&gt;Except for specific situations, we shouldn't do queries without "WHERE"&lt;/strong&gt;. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Update
&lt;/h3&gt;

&lt;p&gt;Is pretty usual to update the data registered, and we use the command &lt;code&gt;UPDATE&lt;/code&gt; to do it. We can change the price of a product, for example, and we will use the "WHERE" in here too.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;UPDATE products SET price=8, quantity=3 WHERE id=1;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example we are updating the product's price and quantity. Note that the WHERE is really important to define which register will be updated. &lt;/p&gt;

&lt;h3&gt;
  
  
  Delete
&lt;/h3&gt;

&lt;p&gt;The delete operation, as you imagine, delete some register. The WHERE is &lt;strong&gt;really&lt;/strong&gt; important in this type of query since if you do not use it, you will delete all the data from the table. So remember: &lt;strong&gt;Always use WHERE!&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DELETE FROM products WHERE id=2; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  And that's it!
&lt;/h2&gt;

&lt;p&gt;I hope you've learned how to create a database and how to do CRUD operations on it! Remember that there are different ways of doing it, so feel free to research more about it.&lt;/p&gt;

&lt;p&gt;If you have any questions you can send me a message! This content was created with my notes during the 100 days of code, in which I learned about database, PHP and Laravel. &lt;/p&gt;

&lt;p&gt;And thanks to the people that reviewed my article and helped me to get here: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a class="mentioned-user" href="https://dev.to/danielhe4rt"&gt;@danielhe4rt&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;
&lt;a class="mentioned-user" href="https://dev.to/cherryramatis"&gt;@cherryramatis&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;
&lt;a class="mentioned-user" href="https://dev.to/reenatoteixeira"&gt;@reenatoteixeira&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>database</category>
      <category>tutorial</category>
      <category>beginners</category>
      <category>braziliandevs</category>
    </item>
    <item>
      <title>Database for newbies: Theorethical Approach</title>
      <dc:creator>Fernanda Fernandes </dc:creator>
      <pubDate>Wed, 20 Mar 2024 19:28:31 +0000</pubDate>
      <link>https://forem.com/basementdevs/database-for-newbies-n46</link>
      <guid>https://forem.com/basementdevs/database-for-newbies-n46</guid>
      <description>&lt;p&gt;Either if you have &lt;strong&gt;just started&lt;/strong&gt; learning programming or if you &lt;strong&gt;already have&lt;/strong&gt; some experience with it, I'm pretty sure you already asked yourself (or others) what a database really is, how you can deal with it, what is the difference between relational and non relational databases and what they are used for. &lt;/p&gt;

&lt;p&gt;When it comes to programming, feels like our doubts are endless and sometimes we can feel lost in this sea of information. I will talk about some concepts that every beginner should know to create its first database. I hope to teach you at least something about database, one of the most important parts of the softwares. &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Table of contents&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
What is database? &lt;/li&gt;
&lt;li&gt;
Types of database 

&lt;ul&gt;
&lt;li&gt;
Relational &lt;/li&gt;
&lt;li&gt;Non-Relational&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;What is SQL?&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is database?
&lt;/h2&gt;

&lt;p&gt;Before everything, it's important to understand what is &lt;strong&gt;data&lt;/strong&gt;. Well, it is a value, like 21. But this data won't have a meaning unless we organize it, creating an information. For example, this number, all alone, could be an age, could be the total people that logged on your website or even your state number. Now if I say to you that we have the data:  &lt;code&gt;age = 21&lt;/code&gt; , we can pretty much understand that the value 21 is someone's age. That's what we call &lt;strong&gt;information&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;Knowing that, I can tell you that database is a collection of organized information. I like to imagine that databases are similar the process of moving to a new home. For example, when we are moving, it is normal to pack our things inside boxes. We would have a box for books, one for clothes and another for electronics. And in the end, we put everything inside a truck and take it to our new home. &lt;/p&gt;

&lt;p&gt;In this example, our database would be the truck, because we have many boxes of specific things - a collection of organized information. This information is structured and normally stored in a computer system. (We use databases to store data, access and maintain it. )&lt;/p&gt;

&lt;p&gt;To control a database, we are going to use what we call as Database Management System (DBMS), softwares used to visualize the database's tables, its information, and where we can also run queries (commands to do actions on the database) and many other things. It's basically a interface between the user - the person using the database - and the database itself.&lt;/p&gt;

&lt;p&gt;We can say that every time we create, delete, update and read - and so much more - we will deal with a DBMS. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwmyuwc2x8ovlc5w376im.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwmyuwc2x8ovlc5w376im.jpg" alt="Image showing how a database management system works" width="800" height="599"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Examples of Database Management System: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;MySQL &lt;/li&gt;
&lt;li&gt;SQL Server &lt;/li&gt;
&lt;li&gt;Oracle Database&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are so many options and we should choose the one that fit us and the project better. &lt;/p&gt;

&lt;h2&gt;
  
  
  Types of database
&lt;/h2&gt;

&lt;p&gt;The most important types of database, the ones every beginner should know are: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Relational Database&lt;/li&gt;
&lt;li&gt;Non-relational Database &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Relational
&lt;/h3&gt;

&lt;p&gt;This type of database is structured using tables with columns and rows, like the image below, and we use SQL to deal with this structure. &lt;br&gt;
In a table, we will have: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Columns, which defines what every piece of data is (ID, Name, Age...) and its type;&lt;/li&gt;
&lt;li&gt;Row, which holds the data given. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff4qx9y567xoz1kasayqc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff4qx9y567xoz1kasayqc.png" alt="Student database table" width="620" height="361"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Every row in the table is a record with an exclusive ID, which we call as a &lt;strong&gt;key&lt;/strong&gt;. In this table, for example, the key would be the numbers 1, 2, 3... We can see that every record has its own key, used to identify itself.&lt;/p&gt;

&lt;p&gt;We have at least three types of keys that every beginner should acknowledge: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Key&lt;/strong&gt; : it is basically one or more columns in a table that will be responsible for identifying in an exclusive way the rows.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Primary Key&lt;/strong&gt; : this type will ensure &lt;strong&gt;uniqueness&lt;/strong&gt; to the register, will refer the register on a relationship between tables and it is &lt;strong&gt;indexed&lt;/strong&gt;, which increases the efficiency of our DBMS. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Foreign Key&lt;/strong&gt; : it is a column that will kind of connect the tables using the primary key of each of them. We use this type of key to create relationships between tables. It is important to understand that the table that has the foreign key is called &lt;strong&gt;reference table&lt;/strong&gt; and the one that is being referred is called &lt;strong&gt;referenced table&lt;/strong&gt; or &lt;strong&gt;father table&lt;/strong&gt;. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Non relational
&lt;/h3&gt;

&lt;p&gt;Non relational database, also called as NoSQL (Not Only SQL, nowadays), are a type of database that don't use the table, and its columns and rows, as an organization scheme. It offers more flexibility because you won't have to worry about creating a table as we have to do on relational databases. &lt;/p&gt;

&lt;p&gt;The storage on NoSQL is optimized and it adapts itself to fit every need. For example, it is possible to storage data as key/value, as JSON documents or as graphics. &lt;/p&gt;

&lt;p&gt;NoSQL databases were created to solve the problem people were suffering until the late 90's, which was the difficulty to design databases that could cope with the scale and agility needed using the relational database, that wasn't able to do it at that time. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3f8ox9vms8ld9ebo1vpv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3f8ox9vms8ld9ebo1vpv.png" alt="SQL vs NoSQL" width="567" height="347"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One of the most important features of NoSQL is: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Higher scalability&lt;/li&gt;
&lt;li&gt;No complex relationship &lt;/li&gt;
&lt;li&gt;Reduced costs &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Non relational databases also have types, and two of them are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Key Value&lt;/strong&gt;: the most common one. Every item on the database will be stored as an attribute name (or 'key') with its value. For example: &lt;code&gt;{"name": "Maria"}&lt;/code&gt;. The key is "name" and the value is "Maria". The most used databases in these cases are &lt;strong&gt;Redis&lt;/strong&gt;, &lt;strong&gt;DynamoDB&lt;/strong&gt; and &lt;strong&gt;Berkeley DB&lt;/strong&gt;. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Document&lt;/strong&gt;: stores each key with its document, and its principal feature is having all the information inside one document. This document normally is a JSON but it can also be a XML, for example. The most famous document database is MongoDB&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are a lot more information about this type of databases but this is the basics you have to know to start! Besides that, don't let this beginning stop you from digging deeper to learn more. &lt;/p&gt;

&lt;h2&gt;
  
  
  What is SQL?
&lt;/h2&gt;

&lt;p&gt;SQL stands for &lt;strong&gt;Structured Query Language&lt;/strong&gt;, a programming language used to work with databases created on the labs of IBM around the 70's. After a while, it became a pattern when it comes to data management. &lt;/p&gt;

&lt;p&gt;We use this programming language to run queries on the database and we can retrieve, create or delete information from the database using the most various parameters. We just have to follow the syntax, just like any other programming language. &lt;/p&gt;

&lt;p&gt;SQL has many &lt;strong&gt;commands&lt;/strong&gt; but the most important ones are: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;SELECT&lt;/strong&gt;: search rows on the database table.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;INSERT&lt;/strong&gt;: insert new rows on the table.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;UPDATE&lt;/strong&gt;: used to update the data that already exists on the table.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DELETE&lt;/strong&gt;: delete a register.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is important to say that we use this commands with other parameters so we can make the queries very specific. And it is a convention to use SQL on Capslock. &lt;/p&gt;

&lt;p&gt;SQL also has some conditions that we can add on our query in order to modify the registers that will be returned, like: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;FROM&lt;/strong&gt;: used to say what table will be consulted. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ORDER BY&lt;/strong&gt;: used to organize the data returned in a specific order.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;WHERE&lt;/strong&gt;: used to &lt;strong&gt;specify the conditions&lt;/strong&gt; of the data to be return. For example, if we want to see the users we have on our table that are older than 18 years old, we would use the 'where'. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are many other commands in SQL but this is the very basic we need to know to create our first table and learn the commands to create our first CRUD, which stands for Create, Read, Update and Delete. &lt;/p&gt;

&lt;h2&gt;
  
  
  And that's it!
&lt;/h2&gt;

&lt;p&gt;Through this article we learned the basics of database, like what it is, it's types and what is SQL. Now, we must learn how to create one, topic covered on the next article of this series. &lt;/p&gt;

&lt;p&gt;This content was created based on my notes during the 100 days of code, in which I learned about database, PHP and Laravel, so I am really proud of it, since I knew almost nothing about it before starting the challenge. Also, feel free to ask me questions if needed!&lt;/p&gt;

&lt;p&gt;And thanks to the people that reviewed my article and helped me to get here: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a class="mentioned-user" href="https://dev.to/danielhe4rt"&gt;@danielhe4rt&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;
&lt;a class="mentioned-user" href="https://dev.to/cherryramatis"&gt;@cherryramatis&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;
&lt;a class="mentioned-user" href="https://dev.to/reenatoteixeira"&gt;@reenatoteixeira&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;

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