MySQL Study Notes 2: Basic Database Operations (create, delete, and view)

Source: Internet
Author: User

MySQL we have installed is a database management tool. What is really valuable is that data in a relational database exists in the form of tables, the aggregation of N tables becomes a database. Now let's take a look at the basic operations of the database.
There are only three points: Create, delete, and view

Create a database
Copy codeThe Code is as follows:
Mysql> create database school;
Query OK, 1 row affected (0.00 sec)

The create database statement is used to create a database.
The school is the name of the database, and the semicolon ends.
If the execution is successful, Query OK is displayed, and the execution time is also displayed.
When a database is available, the current database is usually viewed.

View Database
Copy codeThe Code is as follows:
Mysql> show databases;
+ -------------------- +
| Database |
+ -------------------- +
| Information_schema |
| Mysql |
| Performance_schema |
| School |
| Test |
+ -------------------- +
Rows in set (0.00 sec)

In this way, the created database is displayed, where school is the one just created
The remaining items exist by default. Do not change them.
Test is used for testing and can be deleted.

Delete Database
Copy codeThe Code is as follows:
Mysql> drop database school;
Query OK, 0 rows affected (0.00 sec)

It's easy to delete. Just run the drop database Command.
Next, you can use show databases to view the results. Note that the semicolon should not be forgotten after the statement. In practice, we operate more than databases, but tables in the database. Therefore, the content here is very simple.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.