当前位置:网站首页>Chapter 4 of getting started with MySQL: creation, modification and deletion of data tables
Chapter 4 of getting started with MySQL: creation, modification and deletion of data tables
2022-07-01 14:34:00 【getupos】
1. Create database
Data table belongs to database , Before creating the database , You should use use < Database name >
Specify the database in which the operation is performed .
1.1 Use create
Statement create data table
Examples are as follows
First create and select the database
2. Look at the data table structure
2.1 View table basic structure
Use describe/desc Statement to view table field information .
Illustrate with examples
Enter the following code
2.2 Look at the detailed structure of the table
3. Modify data sheet
After the data table is created , You can also modify the data table according to the actual needs
3.1 Modify data table name
Table names are uniquely defined in a database , The database system distinguishes different tables by table names
Data table update code format
for example
take company In the database emp Change the table to emps
Input sql sentence
3.2 Modify field data type
Change the data type of the field , Is to convert the data type of a field into another data type . stay MySQL The syntax format of modifying the field data type in is as follows :
The main parameters are introduced as follows .
Table name : Refers to the name of the table where the field of the data type to be modified is located .
Field name : Refers to the field to be modified .
data type : Refers to the new data type of the modified field .
give an example
Check the data table before operation name type
modify name
3.4 Modify the field name of the data table
After the field names in the data table are set , It's not static , You can modify the field name as needed .MySQL The syntax format of modifying the table field name in is as follows :
The main parameters are introduced as follows .
Table name : The data table of the field name to be modified . Old field name : Refers to the field name before modification .
new field name : Refers to the modified field name .
New data types : Refers to the modified data type , If you don't need to modify the data type of the field , You can set the new data type to be the same as the original , But the data type cannot be empty .
give an example
边栏推荐
- Websocket (simple experience version)
- Leetcode(69)——x 的平方根
- 深度合作 | 涛思数据携手长虹佳华为中国区客户提供 TDengine 强大企业级产品与完善服务保障
- Realize queue with stack and stack with queue (C language \leetcode\u 232+225)
- 【阶段人生总结】放弃考研,参与到工作中,已经顺利毕业了,昨天刚领毕业证
- Research Report on development trend and competitive strategy of global vibration polishing machine industry
- Develop small programs and official account from zero [phase III]
- 光环效应——谁说头上有光的就算英雄
- sqlilabs less10
- Halo effect - who says that those with light on their heads are heroes
猜你喜欢
博文推荐 | 深入研究 Pulsar 中的消息分块
What problems should be considered for outdoor LED display?
户外LED显示屏应该考虑哪些问题?
Leetcode (69) -- square root of X
241. 为运算表达式设计优先级
Basic operation of queue (implemented in C language)
如何看待国企纷纷卸载微软Office改用金山WPS?
2022-2-15 learning the imitation Niuke project - post in Section 2
Realize queue with stack and stack with queue (C language \leetcode\u 232+225)
【15. 区间合并】
随机推荐
手把手带你入门 API 开发
Research Report on the development trend and competitive strategy of the global navigation simulator industry
Effet halo - qui dit qu'il y a de la lumière sur la tête est un héros
2022-2-15 learning the imitation Niuke project - Section 3 post details
Sorting learning sorting
WebSocket(简单体验版)
Leetcode (69) -- square root of X
被裁三个月,面试到处碰壁,心态已经开始崩了
SWT / anr problem - how to capture performance trace
【阶段人生总结】放弃考研,参与到工作中,已经顺利毕业了,昨天刚领毕业证
How can we protect our passwords?
MIT团队使用图神经网络,加速无定形聚合物电解质筛选,促进下一代锂电池技术开发
SWT/ANR问题--当发送ANR/SWT时候如何打开binder trace(BinderTraces)
111. Minimum depth of binary tree
What "hard core innovations" does Intel have in the first half of 2022? Just look at this picture!
How to view the state-owned enterprises have unloaded Microsoft office and switched to Kingsoft WPS?
2022-2-15 learning xiangniuke project - Section 1 filtering sensitive words
[Verilog quick start of Niuke question series] ~ use functions to realize data size conversion
问题随记 —— Oracle 11g 卸载
Websocket (simple experience version)