Detailed operations of creating a new database and creating, modifying, deleting a data table and deleting a database in Navicat

When I have time, I wrote about the operation of navicat to manage mysql, and it took a long time to write with screenshots. Welcome to the "navicat from entry to entry" and "mysql from entry to database deletion..." series.

Table of contents

1. Create a new database

2. Create a new data table

1. Create a new table

2. Create a table structure

3. Check the content of the table

4. Add table content

3. Modify the data table

1. Modify the content of the data table

2. Modify the data table structure

4. Delete the data table

5. Delete the database


Navicat is a graphical database management tool software.

What is the use of introducing database management software to manage data?

We can control the database by inputting SQL statements through the command line. When the database graphical management software is introduced, the operation of SQL statements can be replaced by interface-based mouse operations, which improves the intuitiveness of the database and reduces the difficulty of database operation. Reduce the workload of the database to a certain extent.

There are many kinds of database management software, and navicat is one of the graphical database management software, which can simultaneously connect to MySQL, MariaDB, MongoDB, SQL Server, Oracle, PostgreSQL and SQLite, which are common databases on the market, from a single application.

This article focuses on the mysql database, and mainly introduces the common basic operations of navicat to connect to the mysql database, including the detailed operations of navicat to create and delete the mysql database and to create, modify and delete data tables.

On the left side of Navicat connecting to the mysql database, you can see the default library under the connection. There are four default libraries.

  1. information_schema (mysql saves the information defining the database)
  2. mysql (core library, storage permissions, etc.)
  3. performance_schema (mysql database performance parameters)
  4. test(test library, empty library)

The test can be deleted, and we cannot operate the rest in it to avoid confusion.

Therefore, our first step in using a database is to create a new one.

1. Create a new database

Click the right mouse button on the blank space of the connection interface on the left side of the navicat interface, and select New Database.

On the pop-up "New Database" page, fill in the database name, and you can choose the character set and collation. The character set and collation can also be unselected, and they are set as default. The default character set is utf8, and the collation is utf8_general_ci.

Click [OK] to complete the creation of the database.

The created database can be seen in the connection sub-interface on the left side of the interface. Select the library, right-click to bring up the menu bar, and select "Database Properties" to view and modify the properties of the database.

Go to the "Database Properties" page, you can see that the character set and collation can be modified. If these two items are not set initially, the following character set and collation will be displayed.

2. Create a new data table

1. Create a new table

First double-click the database that needs to be built on the left to make it green, indicating that the database is activated. Here the library I created is sh_db.

2. Create a table structure

The newly created data table has a blank row, and the designed table structure can be written directly. For example, write an id column first, the type is int, the length is 4, no null values ​​are allowed, and it is the primary key.

After that, you can add rows through the menu bar or the right-click menu [Add Column] and [Insert Column]. Adding a column is adding a new row after the current row, and inserting a column is adding a new row before the current row.

Add the column design of the table structure as follows: The type of username is varchar, the length is 10, and no null value is allowed; the type of password is varchar, the length is 20, and no null value is allowed; phone is the phone number, consider adding the area code and international number, and set the type varchar, length 18, has some redundancy, and allows null values; register_time is the registration time, choose datetime type, the length does not need to be set, this content is not important, and considering that this value is automatically written by the system, it is allowed during debugging null value.

After completion, click the [Save] icon in the menu bar, and a prompt box for filling in the table name will pop up.

Enter the table name sh_users in the table name prompt box, click OK to save, and you can see that the table has been created. You can see this data table in the database list on the left side of the navicat software interface.

This table can also be seen in the table frame on the upper right of the navicat software interface. At this point, we have completed the creation of the table structure.

3. Check the content of the table

There are many ways to view the data table that has been built. There are shortcut menu buttons on the upper right menu bar to operate; you can also select the table first, and then right-click to expand the right-click menu. The figure below shows the upper shortcut menu button and right-click menu.

When "Design Table" is selected, the table structure of sh_users is displayed, as shown in the figure below.

When you select "Open Table", what you can see is the content of the sh_users table, which is currently empty.

4. Add table content

You can add a table record by inserting data in the blank space of the cell. For example, here we insert a record with the user name "Zhang San".

At the bottom of the interface is the "+" icon, and the text "Insert Record" will be displayed when the mouse is moved over. Click this icon button to insert the next record, as shown in the figure below.

Note that this insertion is done on the upper line with id 1001. When the new content is edited and has not been saved, the bottom "√" icon changes from gray to black, and it becomes available. When the mouse moves over , it will prompt "Apply Changes", indicating that the function of this button is to save the changed data. We click the √ icon, and the row data is written into the database.

We can write a few more lines of records at a time, and click the √ icon for the last time to save the application.

3. Modify the data table

1. Modify the content of the data table

There are two ways to modify the content of the data table.

The first is simple: you can directly position the cursor in the cell to be modified, and you can modify it.

The second is slightly more complicated: we select a row of records in the table content interface and select the triangle icon at the bottom to enter the row record content editing interface, as shown in the figure below, which can be modified.

When you click to enter the editing state, you will enter the following interface.

Compared with the previous interface, there are two changes in the interface: one is that the icon on the left side of the line has changed; the other is that the state of the three icons on the bottom has changed: the triangle button (editing function) has become grayed out and becomes unavailable, √ The button (Apply Changes) is darkened and becomes available, and the × button () is darkened and becomes available.

Remember to click the √ button to apply the changes after modifying the data.

2. Modify the data table structure

Select the data table to be edited, click "Design Table" to enter the table structure page

On this page, we can redefine the column content as when creating a new table. Such as setting auto-increment, or padding with zeros.

At this point, the content of table creation and maintenance has been mastered...you can happily fast-forward to the steps of deleting the database and running away~

4. Delete the data table

Select the data table and click Delete Table to quickly delete the data table.

5. Delete the database

Select the library on the left, right click to delete, and the library is gone.

For hospice care before being buried, send a friendly reminder: Deleting the library is a moment of pleasure, and the loved ones cry

Guess you like

Origin blog.csdn.net/shenxianyiya/article/details/130873849