The use of database graphical tools in idea

Table of contents

1. Database connection

1. Open idea and open a project at will

2. Click the database icon on the right

3. Click the + sign to create a database connection

4. Edit database connection information

5. If you have not downloaded the database driver before, you need to download the database driver.

6. Click test connection. If successful appears, it means the connection is successful.

7. Database connection created successfullyEdit

2. Display of local database

1. For better operation, you can drag the icon to the left

2. Display all locally existing databasesEdit

3. Create database

1. Right click, new, schema (schema represents a database)

2. Edit the database name

3. Created successfullyEdit

4. Create tables, fields and insert data

1. Method 1: Run sql statement

2. Method 2: Create a table using table

5. Deletion of databases and tables

1.Delete table

2. Deletion of database

6. Execution location of queries and other sql statements

1. Open query console: where sql statements are executed

2. Write the sql statement to be executed

3. Execution successful


1. Database connection

1. Open idea and open a project at will

    Here open the springboot empty project created before

    Idea creates a springboot project and introduces mybatis dependencies

2. Click the database icon on the right

3. Click the + sign to create a database connection

    Connect to mysql here. If you use other databases, you can also connect to other databases.

4. Edit database connection information

5. If you have not downloaded the database driver before, you need to download the database driver.

6. Click test connection. If successful appears, it means the connection is successful.

7. The database connection is created successfully

2. Display of local database

1. For better operation, you can drag the icon to the left

2. Display all databases that exist locally

3. Create database

1. Right click, new, schema (schema represents a database)

2. Edit the database name


3. Created successfully

4. Create tables, fields and insert data

1. Method 1: Run sql statement

    (1) Click query console, paste the sql statement into the open console, select the sql statement, and click the little green to run

    (2) sql statement

create table user(
                     id int unsigned primary key auto_increment comment 'ID',
                     name varchar(100) comment '姓名',
                     age tinyint unsigned comment '年龄',
                     gender tinyint unsigned comment '性别, 1:男, 2:女',
                     phone varchar(11) comment '手机号'
) comment '用户表';

insert into user(id, name, age, gender, phone) VALUES (null,'喜羊羊',4,'1','13000000000');
insert into user(id, name, age, gender, phone) VALUES (null,'美羊羊',3,'2','13000000001');
insert into user(id, name, age, gender, phone) VALUES (null,'懒羊羊',3,'1','13000000002');
insert into user(id, name, age, gender, phone) VALUES (null,'暖羊羊',5,'2','13000000003');
insert into user(id, name, age, gender, phone) VALUES (null,'沸羊羊',4,'1','13000000004');
insert into user(id, name, age, gender, phone) VALUES (null,'慢羊羊',11,'1','13000000005');

2. Method 2: Create a table using table

(1) Create table

(2) Edit table information

(3) Add a field: click the + sign, click column

(4) Set field information

(5) Create the second field and multiple fields: click the + sign to set field information

(6) Pay attention to setting a primary key

(7) View table structure

(8) Add data to the table:

5. Deletion of databases and tables

1.Delete table

    Right click: click drop

2. Deletion of database

If the database has been deleted but is still displayed on the left, you need to refresh it.

6. Execution location of queries and other sql statements

1. Open query console: where sql statements are executed

2. Write the sql statement to be executed

    Select the sql statement, click the small green button, and execute

3. Execution successful

Guess you like

Origin blog.csdn.net/m0_62264065/article/details/135231848