Another Mysql online training platform, without installation, you can learn online

introduce

Recently, Huang has discovered a very good platform [Motianlun]. Fortunately, the platform has just been released 数据库在线实训平台. Currently, it supports six types of databases: Oracle, MySQL, Redis, PostgreSQL, openGauss and MogDB, which can definitely satisfy your needs. demand.

Let me first evaluate MySQL for everyone. The platform supports MySQL 8.0 and the operating system is Ubuntu 21.04.

Login to MySQL database

Ferris wheel homepage link: https://www.modb.pro/

Before entering the training platform, we need to log in. Then, enter the link https://www.modb.pro/market/150159?cp, you can directly enter the database online training platform. The main interface is roughly as follows:
insert image description here
Log in to the MySQL server:

mysql -uroot -p
--输入数据库列表页面中的密码--

The password is in the database list page:
insert image description here
after successful login, the interface is as shown in the figure:
insert image description here

Use of MySQL database

1. Check which databases the system has

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

Of course, this is the database that comes with the system, and we'd better not use it. So we can create a database of our own.

2. Create the database

mysql> create database huang;
Query OK, 1 row affected (0.01 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| huang              |
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
5 rows in set (0.00 sec)

Here, we create our own database of data huang, and then look at the database in the system again, and a new database has been added at this time.

3. Using the database

mysql> use huang;
Database changed

This line of code must be used, indicating that we want to operate this database later. Otherwise, the system does not know which database you are operating, and an error will be reported.

4. Create a table

Here we want to create one 学生表with a total of 4 fields.
insert image description here
The table creation statement is as follows:

mysql> create table student(
    ->     sid varchar(20),
    ->     sname varchar(20),
    ->     sage datetime,
    ->     ssex varchar(10)
    -> )charset=utf8;
Query OK, 0 rows affected, 1 warning (0.04 sec)

After the table is created, you can view the tables in the database.

mysql> show tables;
+-----------------+
| Tables_in_huang |
+-----------------+
| student         |
+-----------------+
1 row in set (0.00 sec)

At this point, we have our own database haungand also create our own tables in that database student.

5. Insert data into the table

The statement to insert data is as follows:

insert into student values
('01' , '赵雷' , '1990-01-01' , '男'),
('02' , '钱电' , '1990-12-21' , '男'),
('03' , '孙风' , '1990-12-20' , '男'),
('04' , '李云' , '1990-12-06' , '男'),
('05' , '周梅' , '1991-12-01' , '女'),
('06' , '吴兰' , '1992-01-01' , '女'),
('07' , '郑竹' , '1989-01-01' , '女'),
('09' , '张三' , '2017-12-20' , '女'),
('10' , '李四' , '2017-12-25' , '女'),
('11' , '李四' , '2012-06-06' , '女'),
('12' , '赵六' , '2013-06-13' , '女'),
('13' , '孙七' , '2014-06-01' , '女');

6. MySQL data query

Look up the list of students born in 1990.
select * from student where  year(sage)="1990";

This article mainly tells you how to use the Motianlun platform to publish. The 数据库在线实训平台specific learning and operation depends on you!

Guess you like

Origin blog.csdn.net/weixin_41261833/article/details/120917364