当前位置:网站首页>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; 边栏推荐
- roslyn folder under bin folder
- 识别“数据陷阱”,发现数据的可疑之处
- The newcomer deleted data by mistake, and the team leader skillfully used MySQL master-slave replication to delay the recovery of losses
- idea built-in translation plugin
- Vue项目通过node连接MySQL数据库并实现增删改查操作
- 阿里一面:多线程顺序运行有多少种方法?
- 适合程序员的输入法
- DHCP principle and configuration
- Boot process and service control
- 从 Google 离职,前Go 语言负责人跳槽小公司
猜你喜欢

Vue项目通过node连接MySQL数据库并实现增删改查操作

Ali Ermian: How many cluster solutions does Redis have?I answered 4

The first artificial intelligence safety competition officially launched

架构设计指南 如何成为架构师

The CTO said I was not advised to use SELECT *, why is that?

Go 使用mencached缓存

RAID disk array

2020 数学建模之旅

UDP和TCP使用同一个端口,可行吗?

Electron之初出茅庐——搭建环境并运行第一个程序
随机推荐
Graphical relational database design ideas, this is too vivid
阿里一面:多线程顺序运行有多少种方法?
Proof of distance calculation from space vertex to plane and its source code
Linx common directory & file management commands & VI editor usage introduction
Electron日常学习笔记
【雷达目标检测】恒定阈值法和恒虚警(CFAR)法及代码实现
Huawei released "ten inventions", including computing, intelligent driving and other new fields
How to understand plucker coordinates (geometric understanding)
Electron中设置菜单(Menu),主进程向渲染进程共享数据
Mobile phone side scroll to page to specify location
export , export default, import complete usage
Vue项目通过node连接MySQL数据库并实现增删改查操作
go : go-redis list操作
schur completement
Oracle查看表空间使用率及爆满解决方案
AI元学习引入神经科学,医疗效果有望精准提升
2020 ACM | MoFlow: An Invertible Flow Model for Generating Molecular Graphs
What new materials are used in the large aircraft C919?
PXE efficient mass network capacity
idea built-in translation plugin