Databases, MySQL and MongoDB [Dev Concepts #35]

In this lesson, we explain the concept of databases in software development, the role of relational databases and the SQL language, and the NoSQL databases in modern software engineering.
Dev-Concepts-Episode-35-Databases-MySQL-and-MongoDB

We will start with the concept of data storage, the need of database systems and the difference between relational and non-relational databases. You will become familiar with the concept of Database Management Systems (DBMS), such as MySQL, MongoDB and Redis.

What is more, you will learn about the relational database model, the SQL language and some of its basic commands for data query and manipulation. In the end, we will explain the NoSQL databases (which hold collections of documents) and how to query and manipulate a document-based NoSQL database.

In the end, we will show you a live demo of how to work with MongoDB and Robo 3T. From the demo, you will learn:

  • how to create a database and a collection of documents
  • how to insert a document
  • how to edit, delete and query documents

Databases

A database is a collection of data that is organized so that it can be easily accessed, managed, and updated. Database Management System (DBMS) usually manages a database. DBMS systems are also called “databases servers“, because they manage data and serve developers through an API, using the “client-server” model of communication.

Databases implement the classical CRUD operations. CRUD is an abbreviation with each letter standing for a single operation.

Those are the basic operations you will be performing on a database:

  • C – Create (or add or insert) new data.
  • R – Read (or retrieve or query) data.
  • U – Update existing data.
  • D – Delete existing data.

Relational and NoSQL Databases

relational-vs-nosql-dbs

Relational databases organize data in tables and data rows. For example, an e-commerce software could have a table holding the products. Each table row could hold product id, product name, description, supplier, and price. In relational databases, the SQL language is used to query and modify data.

NoSQL databases hold collections of documents or key-value pairs. Document databases (like MongoDB) manage collections of documents (such as products or vendors). These key-value pair structures are also known as “dictionaries“. They support a fast “search by key” operation. Key-value data storage systems are good for organizing simple data.

From Data Storage to Databases

Databases give you the possibility to keep different data about the same thing in columns or properties. Multiple data objects of the same type can be stored in a table or collection. Such data objects are also called “entities“.

table-data-info

In the image above, we have several entities like products, customers, and orders. Each entity would have several data characteristics, which can be stored in data columns or object properties. This way the data has “structure“. It is organized consistently and in a manageable way. Each row holds a single entity (in this example – an order). As you may have guessed, this is much more optimized than keeping physically thousands of receipts (on paper or in text files).

Why Do We Need Databases?

There are far more reasons to use a database rather than physical storage. Data storage is not the primary reason to use a database system.

As we said earlier, imagine having thousands of receipts. It would be quite impractical to search these receipts unless they are carefully structured and ordered. That is easily solved with a database as it is stored on your computer, or even on a cloud service. Database tables and collections can be indexed, and this allows searching millions of documents in milliseconds.

Database systems are an important component of most modern software systems, and therefore software engineers must have at least basic database skills. They are very powerful in keeping collections of entities and implement efficiently the CRUD operations, queries, searching, and many more.

Lesson Topics

In this tutorial, we cover the following topics:
  • Database Intro

  • SQL vs NoSQL Databases

  • DBMS Systems

  • Relational Databases and SQL

  • NoSQL and MongoDB

Lesson Slides

Leave a Comment

Recent Posts

About SoftUni

SoftUni provides high-quality education, profession and job to people who want to learn coding.

The SoftUni Global “Learn to Code” Community supports learners with free learning resources, mentorship and community help.

Tags

Categories