当前位置:网站首页>MySQL command statement (personal summary)
MySQL command statement (personal summary)
2022-07-28 19:57:00 【Mountains and rivers don't grow old】
Catalog
1 Add sentences
1.1 Add information to the list
insert into table_name(list_name,list_name......) values('values1','values2'.......),('values1','values2'........);
1.2 Add column to table
The operation of adding columns is similar to the following line of code , among table_name Is the table name you want to modify ,last_name Is the column name you want to add ,varchar(10) You can change it to the data type and value range you want .
alter table table_name add last_name varchar(10);
2 Delete statements
2.1 Delete the specified column
alter table table_name drop last_name;
2.2 Delete the specified information
( Delete one or more records )
2.2.1 Delete the entire list
delete from table_name;
2.2.2 Delete a record
delete from table_name where list_name='values';
2.3 Clear data in table
delete from table_name;
truncate table table_name;
3 Modify the information
3.1 Modify database code
In the following code database_name Is the name of the database you want to set ,gb2312 You can replace it with your own encoding format
alter database database_name character set gb2312;
3.2 Modify the value type or range of a table column
The modification method is the same as the above examples
alter table table_name modify list_name varchar(10);
3.3 Modify the name of the table
now_name Current table name
new_name Modified table name
rename table now_name to new_name;
3.4 Modify the character set encoding format of the table to utf-8
alter table table_name character set utf-8;
3.5 Change column names
alter table table_name change column name list_name varchar(100);
3.6 Modify the record
The first line of code simply modifies the data
The second line can add or subtract data on the original basis
update table_name set list_name=values,list_name=values where list_name=values;
update table_name set list_name=value+1000 where list_name=value;
4 Export import database
== Get into cmd ==
4.1 Export database (sql Script )
mysqldump -u user name -p Database name > Exported file name
mysqldump -u root -p db_name > test_db.sql
4.2 mysql Export a database table
mysqldump -u user name -p Database name Table name > Exported file name
mysqldump -u wcnc -p test_db users> test_users.sql ( There is no semicolon at the end )
4.3 mysql Import database
source File directory / name .sql
5 Query information
5.1 Query table structure
desc table_name;
边栏推荐
- 为研发高端光刻胶,晶瑞股份斥资7500万元购买SK海力士的ASML光刻机
- Thoroughly understand bit operations - shift left, shift right
- 基于QTGUI图像界面的空战游戏设计
- Question bank and answers of the latest national fire-fighting facility operators (intermediate fire-fighting facility operators) in 2022
- adb remount of the / superblock failed: Permission denied
- Getting started with enterprise distributed crawler framework
- MySQL8 Encrypting InnoDB Tablespaces
- Android-第十三节03xUtils-数据库框架(增删改查)详解
- 芯片功耗性能验证:从困境到超越
- 冲刺金九银十丨熬夜半个月汇集大厂Android岗1600道面试真题
猜你喜欢

Cloud computing notes part.2 - Application Management

Codeignier framework implements restful API interface programming

Idea properties file display \u solution of not displaying Chinese

CodeIgnier框架实现restful API接口编程

Leetcode Day1 score ranking

Information management system and games based on C language

云原生编程挑战赛火热开赛,51 万奖金等你来挑战!
![[wechat applet development] page navigation and parameter transmission](/img/10/76b6592fa9e71073831887c4fb6da9.png)
[wechat applet development] page navigation and parameter transmission

There is a 'single quotation mark' problem in the string when Oracle inserts data

JS preventdefault() keyboard input limit onmousewheel stoppropagation stop event propagation
随机推荐
KPMG China: insights into information technology audit projects of securities fund management institutions
How does app automated testing achieve H5 testing
Information management system and games based on C language
Failed to install app-debug. apk: Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI]
基于MATLAB的函数拟合
[NPP installation plug-in]
克服“看牙恐惧”,我们用技术改变行业
Business visualization - let your flowchart "run" (4. Actual business scenario test)
Leetcode day3 employees who exceed the manager's income
Integration and implementation of login click graphic verification code in personal blog system
11. Learn MySQL union operator
MySQL 8 creates master-slave replication based on Clone
MySQL8 Status Variables: Internal Temporary Tables and Files
Article translation software - batch free translation software supports major translation interfaces
JS preventdefault() keyboard input limit onmousewheel stoppropagation stop event propagation
The United States will provide $25billion in subsidies to encourage chip manufacturers such as Intel to move back to production lines
English translation Portuguese - batch English conversion Portuguese - free translation and conversion of various languages
The opening price soared by 215%! Domestic signal chain chip enterprise Xinhai Technology landed on the scientific innovation board
基于C语言的信息管理系统和小游戏
Leetcode day2 连续出现的数字