MySQL's library

Source: Internet
Author: User

Oberzhang talked about MySQL installation, since the data is installed! Let's learn the SQL statements together.

SHOW DATABASES; To view existing data

CREATE DATABASE ' Test_python '; Create a library named "Test_python"

SHOW CREATE DATABASE ' Test_python '; View the CREATE statement for the Test_python library


Attention:

1. When you view the creation statement for a database, the default format is a table. If you encounter a particularly long table will show ugly, this time we have to adopt a display format \g.

SHOW CREATE DATABASE ' Test_python ' \g

2.sql statements inside the name are added "anti-single quote" ' name ', which is to tell MySQL this is a name, avoid and keyword conflict.

3.sql statement to use, or \g end. Otherwise it's just a line to continue writing.

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/93/3A/wKioL1kJeveShHEBAAAMANyqw1s173.png "title=" 1.png "alt=" Wkiol1kjeveshhebaaamanyqw1s173.png "/>

4. If the operation error is wrapped, and the code is the wrong code. To avoid the error, we can use \c to end and cancel the command.

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/93/3A/wKioL1kJe3yChbVOAAAPCnZcVSk077.png "title=" 1.png "alt=" Wkiol1kje3ychbvoaaapcnzcvsk077.png "/>

5.sql statements are recommended to use uppercase, and MySQL can support lowercase. However, in order to standardize we still use capital. In SQL database (not just MySQL) agree to have a specification that usually keywords or reserved words are capitalized, custom names are usually lowercase and with anti-quotes.

When we look at the creation statement for the library, we see that UTF8 encoding is used by default. That's why we changed the configuration file. We can also specify the encoding when creating the library without modifying the configuration file.

CREATE DATABASE ' test_db1 ' CHARSET utf8;

Note that the database is UTF8 and not utf-8.

You can use drop to delete a library

DROP DATABASE ' test_db1 '

Already built libraries, if you want to adapt the code can be modified using ALTER.

ALTER DATABASE ' test_db1 ' CHARSET utf8;

Now that we can use ALTER to modify the database, can we rename the word? The answer is no, if you want to change, you first create a new database, and then the database of the table all moved past.



This article is from the "Good Time" blog, please be sure to keep this source http://timehistory.blog.51cto.com/12690735/1921644

MySQL's library

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.