Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does MySQL allows to create database with dot?

Does MySQL allows to create database which has dot (.) in its name?

I'm using MySQL 5.1.22.

like image 327
GrZeCh Avatar asked Apr 22 '09 08:04

GrZeCh


People also ask

Why dot is used in MySQL?

Dot notation (sometimes called the membership operator ) qualifies an SQL identifier with another SQL identifier of which it is a component. You separate the identifiers with the period (.) symbol.

Can we create a database in MySQL?

Open the MySQL Workbench as an administrator (Right-click, Run as Admin). Click on File>Create Schema to create the database schema. Enter a name for the schema and click Apply. In the Apply SQL Script to Database window, click Apply to run the SQL command that creates the schema.

Can SQL table name have dot?

Complex SQL actions are processed in sql language and will work fine, if the base is fine. These errors may more often be found in 3rd party software, so never ever use dots in every name of anything on sql server.

Which keyboard is used to create a database?

Correct Option: B The statement 'CREATE DATABASE database_name;' is used to create a database with the name 'database_name'.


1 Answers

You can't use the dot in a database name. Also, I'd avoid using it in any identifier. A common convention is to use underscore instead. It will serve the same purpose and will avoid a LOT of confusion. If you do have a good reason for using strange and otherwise-illegal characters in a table or field name, then you have to escape it.

to escape identifiers in MySQL, use the backtick:

SELECT `select`, `some.field name`, `crazy()naming+here` FROM `my-=+table` 

Getting into the habit of backticking all field names regardless of whether you need to is a good practice in my opinion, but that's another story.

like image 125
nickf Avatar answered Oct 13 '22 18:10

nickf