All Learning Paths

What is...

DatabasesWeb DevelopmentUbuntu
Browse all tutorialsBrowse all topic tagsAsk a question

Enjoy $200 to try DigitalOcean

Click below for $200 of free credit to try DigitalOcean on us for the next 60 days. Thank you for being a part of our community!

Join Now

Web hosting without headaches

Try Cloudways, the #1 managed hosting provider for agencies & developers, with $100 in free credit!

Learn More

Learning Paths

Learn the way you want to learn with our common learning paths and learning goals. More to come soon!

Introduction to Databases

View all Databases content ->

What is a Database?

A database is simply the collection of information (or data) organized in a specific way. We often think of a database as a digital database (that is, accessed via a computer), but there are physical databases as well (for example, a library that contains many books might be called a physical database).

Digital databases are unique. A digital database has many different ways of collecting, scaling, and storing information. Most important of all, however, is how that data in the database can be queried, visualized, or manipulated to gather key insights.

What types of databases are there?

There are many different types of databases that can be used to suit your specific needs. A database can be centralized with all the data held in one place, or a database can be distributed with data stored across multiple, separate places. Databases can be relational with data stored in a way that this database data can be related to each other, or a database can have data with no internal relationships. There are also databases that can store data of any type, beyond just text and numbers. The breadth of database software, types, and functionality in the developer ecosystem is vast.

What is a distributed database?

Distributed databases have information stored in different places or sites (on the same network or on different networks). In many distributed database systems, data is shared across multiple nodes in a cluster. A distributed database system makes it possible to (scale the database horizontally)[/community/questions/horizontal-scaling-with-mongodb-and-nodejs] by adding new nodes as demand increases. A database cluster that is configured with some amount of redundancy can be used to achieve high-availability, ensuring that your application doesn’t suffer downtime when individual database nodes fail.

Document databases (more on this below) like MongoDB are designed to be used in clusters. For distributed relational databases, you can create a MySQL cluster by using the NDBCluster storage engine or a distributed SQL database like CockroachDB.

What is a relational database?

A relational database stores data that has some relation to itself. This is an intuitive way to think about data as naturally, even in our own brains, we typically store related data together like in relational databases rather than as unstructured data.

Consider that you run a small business. You might have one table in your database containing information about your customers. This first database table might have rows with a unique ID for each customer, and the columns might contain common attributes of each customer: their name, email address, etc. You might then have a second database table for shipping information, which would have rows with unique IDs for each customer and columns with key shipping information: address, zip code, etc. Though you have two tables in your database, you can relate the tables to each other through that unique ID created for each customer. In that way, you are now using a relational database or relational databases.

When you have one table that can be related to many other tables (in the example above, through the use of a unique ID), these databases are sometimes referred to as a one-to-many database relationship.

Applications that use relational databases often use object-relational mapping, which makes it possible to interact with relational data from an object-oriented programming language. Some popular object-relational mapping or ORM-based frameworks include Flask, Laravel, Spring, Rails/ActiveRecord, and Sequelize.

One of the common ways to access data stored in a relational database is through the structured query language or SQL (pronounced sequel) for short.

What is SQL (structured query language)?

SQL is a language that lets you access and manipulate a database to get the insights or information you’re looking for from that relational database. SQL relies on a Relational Database Management System (or RDBMS), such as MS SQL Server, MySQL, Microsoft Access, and others, to pull out the database data you need with simple queries.

MySQL, an open source relational database management system, is quick to install on Ubuntu and get started with and can be accessed remotely. You can also import and export whole databases in MySQL.

A drop-in alternative to MySQL is MariaDB, which offers database licensing and community support benefits. You can switch from MySQL to MariaDB or install MariaDB on a linux server in a few steps.

Another common relational database management system used is PostgreSQL. This relational database management system can also be installed on a linux server or used with other technologies to build an application.

Overall SQL is a common language to learn if you will be working with a relational database, and we have lots of database and SQL tutorials that can help.

How does a database fit into my application?

Most developers exploring databases want to understand how to attach, manage, and use a database in the context of an application they are building. There are many popular open source tech stacks for building an application inclusive of a database management system (DBMS). Two of the common technology stacks are:

  1. MERN stack, which is an acronym for the four essential technologies in the stack: a MongoDB database, Express framework, React / Redux, and Node.js. The MERN stack is one of the most popular JavaScript stacks for building a single-page web application.
  2. LAMP stack, which is an acronym for the four essential technologies in the stack: a Linux operating system, Apache web server, the MySQL database, and PHP for content processing. Installing the LAMP stack on Ubuntu can be done in a few steps. It is increasingly common to see pieces of the LAMP stack swapped in and out (e.g., PostgreSQL or SQLite in lieu of MySQL database management systems, Flask or Django in lieu of PHP, and Nginx in lieu of Apache). It is also common to see other L*MP options such as LEMP with E being for nginx (pronounced engine-x) or LOMP which is a Linux, OpenLiteSpeed, MariaDB (for the database component), and PHP stack.
What is a NoSQL database?

NoSQL databases are any database management system (dbms) that uses a non-relational model, which means it isn’t compatible with the SQL query language. A document-oriented database is often also a NoSQL database that can store all types of data in a document collection, typically XML, JSON, or BSON formats. There are many popular open source databases that can use NoSQL data models or involve NoSQL databases, including Redis (a key-value store), MemcacheDB, Cassandra, MongoDB, Couchbase, Elasticsearch, OrientDB, and Neo4j (one of the graph databases).

What other database topics should I explore?

When learning how to set up, manage, and use different database software, there are other important database topics. You’ll want to explore best practices with regards to data security, storing data and data storage, querying data, data integrity and maintaining data integrity, data management, control access, and general trends in database technology.

Need help hosting your database?

DigitalOcean can help host your database. We have tools for supporting databases built in MongoDB, PostgreSQL, MySQL, and Redis. We also have many database tutorials and guides to help you work with different databases (for example, here is a tutorial on how to migrate redis data to DigitalOcean).

For other online resources related to databases, check out our community articles and user guides and ask and answer questions in our Q&A forum. Interested in worry-free database hosting? Check out DigitalOcean’s database offerings.

Back to top

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel