当前位置:网站首页>MySQL basics [naming convention]
MySQL basics [naming convention]
2022-07-30 08:03:00 【The brain can't be empty】
Directory
First, the naming problem of MySQL under different systems
1.Linux
- Database name and table name are strictly case-sensitive;
- Table aliases are strictly case-sensitive;
- Column names and column aliases are case-insensitive in all cases;
- Variable names are also strictly case-sensitive;
2. Windows
- All are case insensitive
Second, a unified writing standard is recommended
The database name, table name, table alias, field name, field alias, etc. are all lowercase. When defining databases, tables, and columns, all use lowercase letters and underscores, and do not use any capital letters.
SQL keywords, function names, bind variables, etc. are capitalized
Third, naming rules
- Database and table names cannot exceed 30 characters, and variable names are limited to 29
- Must only contain A–Z, a–z, 0–9, _total63 characters
- Database name, table name, field name and other object names do not contain spaces
- In the same MySQL software, databases cannot have the same name; in the same database, tables cannot have the same name; in the same table, fields cannot have the same name
- You must ensure that your fields do not conflict with reserved words, database systems, or common methods.If you insist, use ` (emphasis) in SQL statements
- Keep field names and types consistent, be sure to consistent when naming fields and assigning data types to them.If the data type is integer in one table, don't change it to character in another table
Example:
#The following two sentences are the same, not case sensitiveshow databases;SHOW DATABASES;#create form#create table student info(...); #The table name is wrong because there are spaces in the table namecreate table student_info(...);#Where order uses ``floating number, because order and predefined identifiers such as system keywords or system function names have the same nameCREATE TABLE `order`();#When making an alias, as can be omittedselect id as "ID", `name` as "name" from t_stu;#If there is no space in the field alias, you can omit ""select id as id, `name` asNamefrom t_stu;#Error, if there are spaces in the field alias, you cannot omit ""select id as id, `name` asNamefrom t_stu; 边栏推荐
- 《心智社会》—马文·明斯基
- 2020 ACM | MoFlow: An Invertible Flow Model for Generating Molecular Graphs
- MySQL master-slave replication configuration construction, one step in place
- Go 使用mencached缓存
- Local Implicit Grid Representations for 3D Scenes详解
- UDP和TCP使用同一个端口,可行吗?
- Proof of distance calculation from space vertex to plane and its source code
- Required request body is missing problem solving
- STL源码剖析:临时对象的代码测试和理解
- 学生成绩管理系统(C语言)
猜你喜欢

2020年度总结——品曾经,明得失,展未来
![[硬核干货]由0到1,突破信息系统项目管理师(呕心沥血经验之谈)!!!](/img/9a/f3e4bdd0ce8ec153a8e6bdbff5647e.jpg)
[硬核干货]由0到1,突破信息系统项目管理师(呕心沥血经验之谈)!!!

和AI一起玩儿剧本杀:居然比我还入戏

STL源码剖析:class template explicit specialization代码测试和理解

The terminal connection tools, rolling Xshell

Calculate the inverse source of the matrix (using the adjoint matrix, a 3x3 matrix)

Electron之初出茅庐——搭建环境并运行第一个程序

mysql高阶语句(一)

@Bean 与 @Component 用在同一个类上,会怎样?

空间直线到平面上的交点的计算证明及其源码
随机推荐
Required request body is missing problem solving
go : go-redis 基础操作
从 Google 离职,前Go 语言负责人跳槽小公司
sizeof
“AI教练”请进家,家庭智能健身蓬勃发展
mysql高阶语句(一)
Derivative Operations on Vectors and Derivative Operations on Vector Cross and Dot Products
MySQL什么时候用表锁,什么时候用行锁?
PXE efficient mass network capacity
手机端滚动至页面指定位置
goto语句
Electron之初出茅庐——搭建环境并运行第一个程序
预测人们对你的第一印象,“AI颜狗”的诞生
空间顶点到平面的距离计算的证明及其源码
Keil软件中map文件解析
The first artificial intelligence safety competition officially launched
Electron日常学习笔记
Upload file -- file type, picture type, document type, video type, compressed package type
MySQL题外篇【ORM思想解析】
不会吧,Log4j 漏洞还没有完全修复?