Операції з екземпляром бази даних
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:
sqlCREATE DATABASE CodefinityGuideDatabase
sqlCREATE DATABASE CodefinityGuideDatabase
Щоб створити таблицю product_descriptions
:
sql912345CREATE TABLE product_descriptions (product_id INT AUTO_INCREMENT PRIMARY KEY,product_name VARCHAR(255) NOT NULL,description TEXT);
Також давайте вставимо деякі випадкові дані в ці таблиці, щоб вони не були порожніми.
user_phones
:
sql9123INSERT INTO user_phones (user_name, phone_number) VALUES('John Doe', '+1234567890'),('Jane Smith', '+0987654321');
product_descriptions
:
sql9123INSERT 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.
Дякуємо за ваш відгук!
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат