Зміст курсу
Java Data Manipulation with Hibernate
Java Data Manipulation with Hibernate
Databases, DBMS
Databases
Welcome to the course! This is another step towards becoming a Java Developer, keep it up!
This course will teach you how to work with databases within Java. From the course Relational Database and Normalization you should already know what a database is, the different types of databases, and how to use them correctly. However, let's quickly review the fundamental concepts once again.
Let's start from the basics, what is a database:
Great, you should also be aware that databases are managed through Database Management Systems (DBMS). We will also be using a DBMS called MySQL in this course. In order to complete the assignments in this course, you will need to install this DBMS on your device.
Note
It's good if you already know how to use other DBMS like Postgres, MongoDB, or SQL Server, but in this course, we will specifically use MySQL. So, it's preferable to use MySQL for the course, as if you encounter issues with other DBMS, neither I nor the community will be able to assist you :).
If you happen to encounter any issues with installing MySQL, you can refer to the step-by-step installation guide in this article. (clickable)
Types of Databases
There are two main types of databases that are in constant competition with each other: relational (SQL) and non-relational (NoSQL) databases.
- Relational Databases (RDBMS): This is the more common type of database. Data is organized in the form of tables with columns and rows. They use the Structured Query Language (SQL) to store, modify, and retrieve data. Examples of RDBMS include MySQL, Microsoft SQL Server, and PostgreSQL;
- Non-Relational Databases (NoSQL): These databases use a less structured way of storing data. They are suitable for large datasets where data access speed and scalability are of particular importance. Examples of NoSQL databases include MongoDB, Cassandra, and Redis.
SQL
Since we will be working with a relational database, it's important to understand what SQL is and what it's used for. We will use SQL frequently to create and manipulate the databases we work with. In case you've forgotten, here's a brief reminder:
With SQL, we can perform four fundamental operations for working with databases, represented by the acronym CRUD:
- Create involves entering new data, adding new rows to a table, or creating new documents;
- Read includes selecting and reading existing data;
- Update involves modifying data in existing records or objects;
- Delete includes removing existing records or objects from the database.
You can learn more about CRUD operations in this chapter. (clickable)
Basic SQL Operations
Let's go over the main SQL operations that we will use in this course. You should already know these operations from the SQL from Zero to Hero track.
SHOW DATABASES
displays all available databases:
USE
specifies which database to use for executing queries:
SHOW TABLES
displays information about tables:
CREATE TABLE
creates new tables:
SELECT
is used to retrieve data from a table:
INSERT
adds new records to a table:
UPDATE
modifies existing records in a table:
DELETE
deletes records from a table:
These are the main operations you need to be aware of.
Note
Please note that operations should be written in uppercase.
The basic material about databases has been reviewed and absorbed. Now, we can move on to more advanced usage of databases in Java-based web applications!
Дякуємо за ваш відгук!