![]() ![]() The output should help you understand the fact that schema is synonymous with the database. We will show a step-by-step process to create a database and schema as well. This implies that the following syntax will achieve the same results as the one we have discussed above.ĬREATE SCHEMA db_name MySQL Create Database Example.Therefore, database or schema are groups of tables. But in MySQL, a schema is synonymous with the database.Its like, the database is a group of schemas and schemas are a group of tables. In other databases, like DB2, there is a difference between database and schema.One needs to have CREATE DATABASE privilege in order to execute this command.Next, will be the database name and it has to be unique. ![]() This is an optional clause and if not mentioned, the default collate of latin1_swedish_ci is used. Collate is a set of rules to be used to compare characters of a particular character set.This is an optional clause and if not mentioned the default character set of latin1 is used. Character set is a legal set of characters that are valid in a string in MySQL.If we try to create a database that already exists and we have not mentioned this optional keyword then it will throw an error. As it’s an optional field, it can be ignored. Next comes the optional field of “IF NOT EXISTS”.This is a mandatory keyword and cannot be omitted. The syntax starts with the keyword “CREATE DATABASE”, thereby informing the MySQL Server about the type of activity to be performed. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
March 2023
Categories |