In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces how to write the statement of creating a database in MySQL. The introduction in the article is very detailed and has certain reference value. Interested friends must read it!
The statement that creates the database is: CREATE DATABASE [IF NOT EXISTS] [[DEFAULT] CHARACTER SET ] [[DEFAULT] COLLATE ];].
Details:
In MySQL, you can create a database using the CREATE DATABASE statement with the following syntax:
CREATE DATABASE [IF NOT EXISTS] [[DEFAULT] CHARACTER SET ] [[DEFAULT] COLLATE ];
The content in [ ] is optional. The syntax is explained as follows:
: Name of the database created. MySQL's data store will represent MySQL databases as directories, so database names must conform to the operating system's folder naming conventions, not start with numbers, and be as meaningful as possible. Note that MySQL is case-insensitive.
IF NOT EXISTS: Decide before creating a database, and perform the operation only if the database does not currently exist. This option can be used to avoid errors where the database already exists and is created repeatedly.
[DEFAULT] CHARACTER SET: Specifies the character set of the database. The purpose of specifying character sets is to avoid garbled data stored in the database. If you do not specify a character set when you create the database, the default character set for the system is used.
[DEFAULT] COLLATE: Specifies the default collation rule for the character set.
Examples:
Create a database named test_db in MySQL. Enter SQL statement CREATE DATABASE test_db; on MySQL command line client to create a database. Enter SQL statement and execution result as follows.
mysql> CREATE DATABASE test_db;Query OK, 1 row affected (0.12 sec);
"Query OK, 1 row affected (0.12 sec);" in the prompt,"Query OK" means that the above command was successfully executed,"1 row affected" means that the operation only affected one record in the database, and "0.12 sec" records the execution time of the operation.
The above is "how to write a statement to create a database in MySQL" all the contents of this article, thank you for reading! Hope to share the content to help everyone, more relevant knowledge, welcome to pay attention to the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
Connect mongodb:public class GenericMga {private DB db; public DB getDB () {re
© 2024 shulou.com SLNews company. All rights reserved.