Operações com Instância de Banco de Dados
This will be a short chapter where I'll show you that even the simplest SQL commands work perfectly fine with a cloud database. Let's, for example, create two tables that will store user phone numbers and a table that will store descriptions of various products.
To do this, open our MySQL Workbench, connect to our cloud database, and create a database for our tutorial:
Here’s the command to create a database:
CREATE DATABASE CodefinityGuideDatabase
CREATE DATABASE CodefinityGuideDatabase
Para criar a tabela product_descriptions
:
CREATE TABLE product_descriptions (
product_id INT AUTO_INCREMENT PRIMARY KEY,
product_name VARCHAR(255) NOT NULL,
description TEXT
);
Além disso, vamos inserir alguns dados aleatórios nessas tabelas para que não fiquem vazias.
user_phones
:
INSERT INTO user_phones (user_name, phone_number) VALUES
('John Doe', '+1234567890'),
('Jane Smith', '+0987654321');
product_descriptions
:
INSERT INTO product_descriptions (product_name, description) VALUES
('Smartphone', 'High-end smartphone with a large screen and advanced camera.'),
('Laptop', 'Portable computer suitable for personal and professional use.');
Thus, we've created a database and two tables in our cloud database. Now, anyone can connect to this database and retrieve the necessary data, or insert new data, and so on.
Let's check if everything is done correctly and retrieve all the information from the user_phones
and product_descriptions
tables:
Thus, we've created a database and two tables in our cloud database. Now, anyone can connect to this database and retrieve the necessary data, or insert new data, and so on.
Let's check if everything is done correctly and retrieve all the information from the user_phones
and product_descriptions
tables:
Thus, we've created a database and two tables in our cloud database. Now, anyone can connect to this database and retrieve the necessary data, or insert new data, and so on.
Let's check if everything is done correctly and retrieve all the information from the user_phones
and product_descriptions
tables:
And the second one:
We created the necessary database and also created and populated two tables in this database. We did this in order to connect to these databases from our EC2 instance in the next chapter, see that the data is stored in the cloud, and retrieve this data from the EC2 instance.
Obrigado pelo seu feedback!
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo
Awesome!
Completion rate improved to 4.55
Operações com Instância de Banco de Dados
Deslize para mostrar o menu
This will be a short chapter where I'll show you that even the simplest SQL commands work perfectly fine with a cloud database. Let's, for example, create two tables that will store user phone numbers and a table that will store descriptions of various products.
To do this, open our MySQL Workbench, connect to our cloud database, and create a database for our tutorial:
Here’s the command to create a database:
CREATE DATABASE CodefinityGuideDatabase
CREATE DATABASE CodefinityGuideDatabase
Para criar a tabela product_descriptions
:
CREATE TABLE product_descriptions (
product_id INT AUTO_INCREMENT PRIMARY KEY,
product_name VARCHAR(255) NOT NULL,
description TEXT
);
Além disso, vamos inserir alguns dados aleatórios nessas tabelas para que não fiquem vazias.
user_phones
:
INSERT INTO user_phones (user_name, phone_number) VALUES
('John Doe', '+1234567890'),
('Jane Smith', '+0987654321');
product_descriptions
:
INSERT INTO product_descriptions (product_name, description) VALUES
('Smartphone', 'High-end smartphone with a large screen and advanced camera.'),
('Laptop', 'Portable computer suitable for personal and professional use.');
Thus, we've created a database and two tables in our cloud database. Now, anyone can connect to this database and retrieve the necessary data, or insert new data, and so on.
Let's check if everything is done correctly and retrieve all the information from the user_phones
and product_descriptions
tables:
Thus, we've created a database and two tables in our cloud database. Now, anyone can connect to this database and retrieve the necessary data, or insert new data, and so on.
Let's check if everything is done correctly and retrieve all the information from the user_phones
and product_descriptions
tables:
Thus, we've created a database and two tables in our cloud database. Now, anyone can connect to this database and retrieve the necessary data, or insert new data, and so on.
Let's check if everything is done correctly and retrieve all the information from the user_phones
and product_descriptions
tables:
And the second one:
We created the necessary database and also created and populated two tables in this database. We did this in order to connect to these databases from our EC2 instance in the next chapter, see that the data is stored in the cloud, and retrieve this data from the EC2 instance.
Obrigado pelo seu feedback!