当前位置:网站首页>Learn MySQL from scratch - database and data table operations
Learn MySQL from scratch - database and data table operations
2022-07-01 19:16:00 【InfoQ】

- Database operation : Delete database 、 modify the database .
- Data table operation : rename table 、 Delete table 、 Add a column of data at the specified position 、 Delete a column 、 Rename a column 、 Change data type 、 Delete a row of records .
https://github.com/rongweihe/MoreThanCode/tree/master/mysql_shiyan# open MySQL service
sudo service mysql start
# Use root The user login
mysql -u rootsource /home/MySQL_05_01.sql;

【 Article Welfare 】 In addition, Xiaobian also sorted out some C++ Back-end development interview questions , Teaching video , Back end learning roadmap for free , You can add what you need :
Click to join the learning exchange group ~
Group file sharing
Xiaobian strongly recommends C++ Back end development free learning address :
C/C++Linux Server development senior architect /C++ Background development architect

RENAME TABLE Original name TO New name ;
ALTER TABLE Original name RENAME New name ;
ALTER TABLE Original name RENAME TO New name ;use mysql_shiyanRENAME TABLE table_1 TO table_2;
DROP TABLE Table name ;DROP TABLE table_2;
3.3 Add a row
Modification of table structure , It will actually affect the structure of the data table , Sometimes small mistakes can have irreparable consequences , So operate carefully . In the actual production environment , Be sure to get the permission of your superiors , Otherwise, do not modify it easily .
Let's see , Add a column to the table in the form of :
ALTER TABLE Table name ADD COLUMN Name data type constraint ;
ALTER TABLE Table name ADD Name data type constraint ;ALTER TABLE employee ADD height INT(4) DEFAULT 170;
ALTER TABLE employee ADD weight INT(4) DEFAULT 120 AFTER age;
ALTER TABLE employee ADD test INT(10) DEFAULT 11 FIRST;
3.4 Delete a column
ALTER TABLE Table name DROP COLUMN Name ;
or :ALTER TABLE Table name DROP Name ;ALTER TABLE employee DROP test;
ALTER TABLE Table name CHANGE The original name New column names data type constraint ;ALTER TABLE employee CHANGE height shengao INT(4) DEFAULT 170;
3.6 Change the data type
ALTER TABLE Table name MODIFY Name New data types ;UPDATE Table name SET Column 1= value 1, Column 2= value 2 WHERE Conditions ;UPDATE employee SET age=25 ,salary=20000 WHERE name='xiaowei';
3.8 Delete a row of records
DELETE FROM Table name WHERE Conditions ;DELETE FROM employee WHERE name='xiaohong';
4、 summary
Reference material

边栏推荐
- Supervarimag superconducting magnet system SVM series
- 【pytorch记录】模型的分布式训练DataParallel、DistributedDataParallel
- indexof和includes的区别
- Example explanation: move graph explorer to jupyterlab
- Shell array
- PriorityQueue的用法和底层实现原理
- js找出数字在数组中下一个相邻的元素
- Intensive cultivation of channels for joint development Fuxin and Weishi Jiajie held a new product training conference
- Chinese and English instructions human soluble advanced glycation end products receptor (sRAGE) ELISA Kit
- Stanford, salesforce|maskvit: masked vision pre training for video prediction
猜你喜欢

PMP是被取消了吗??

Leetcode-160 intersecting linked list

Chinese and English instructions human soluble advanced glycation end products receptor (sRAGE) ELISA Kit

宝,运维100+服务器很头疼怎么办?用行云管家!

Netease games, radical going to sea

毕业季 | 华为专家亲授面试秘诀:如何拿到大厂高薪offer?

M91 fast hall measuring instrument - better measurement in a shorter time

Lumiprobe 细胞成像研究丨PKH26细胞膜标记试剂盒

Lumiprobe 自由基分析丨H2DCFDA说明书

bean的生命周期核心步骤总结
随机推荐
Today, with the popularity of micro services, how does service mesh exist?
Docker deploy mysql8.0
Example explanation: move graph explorer to jupyterlab
2020,最新手机号码手机验证正则表达式,持续更新
More information about M91 fast hall measuring instrument
B2B e-commerce platform solution for fresh food industry to improve the standardization and transparency of enterprise transaction process
Database foundation: select basic query statement
Leetcode-141 circular linked list
Excel之VBA简单宏编程
Openai video pre training (VPT): action learning based on watching unmarked online videos
组队学习! 14天鸿蒙设备开发“学练考”实战营限时免费加入!
R language ggplot2 visualization: visualize the line graph and add customized Y-axis label information to the line graph using the labels function
Stanford, salesforce|maskvit: masked vision pre training for video prediction
Technical secrets of ByteDance data platform: implementation and optimization of complex query based on Clickhouse
如何运营好技术相关的自媒体?
Lumiprobe cell imaging study PKH26 cell membrane labeling kit
小红书上的爱情买卖
太爱速M源码搭建,巅峰小店APP溢价寄卖源码分享
华为游戏初始化init失败,返回错误码907135000
Supervarimag superconducting magnet system SVM series