当前位置:网站首页>Basic MySQL
Basic MySQL
2022-06-26 10:33:00 【Yimuzixi】
DDL
Database operation
show databases;
create databases;
use Database name ;
select database();
drop database Database name ;
Table operations
show tables;
create table Table name ( Field Field type , Field Field type );
desc Table name ;
show create table Table name ;
alter table Table name add/rename to...;
alter table Table name modify Field name New data types ( length );
alter table Table name change Old field name new field name type ( length ) [comment notes ][ constraint ];
drop table Table name ;
DML
insert into Table name ( Field 1, Field 2..)values( value 1, value 2,..);
update Table name set Field 1= value 1,where Conditions ;
delete from Table name where Conditions ;
DQL

DCL
User management
create user ' user name '@' Host name ' identified by ' password ';
alter user ' user name '@' Host name ' identified with mysql_native_password by ' password ';
drop user ' user name '@' Host name ';
Access control 
grant Permission list on Database name . Table name to ' user name '@' Host name ';
revoke Permission list on Database name . Table name from ' user name '@' Host name ';
function
String function

Numerical function

Date function

Flow function

constraint
1. Non empty constraint :not null
2. Unique constraint :unique
3. Primary key constraint :primary key( Self increasing :auto_increment)
4. Default constraint :default
5. Check constraint :check
6. Foreign key constraints :foreign key
Multi-table query
Multi table relation

Multi-table query

Business
A transaction is a collection of operations , Or it all works , Or all failed .
start transaction;-- Open transaction
commit/rollback;-- Submit / Roll back the transaction
Four characteristics ACID
Atomicity (Atomicity): Transactions are the smallest and indivisible unit of operations , All or nothing , All or nothing .
Uniformity (Consistency) : When the transaction completes , All data must be kept consistent .
Isolation, (lsolation): The isolation mechanism provided by the database system , Ensure that transactions run in an independent environment that is not affected by external concurrent operations .
persistence (Durability): Once a transaction is committed or rolled back , Its changes to the data in the database are permanent .
Transaction isolation level 
边栏推荐
- JVM垃圾回收什么情况会进入老年代
- [sans titre]
- MySQL项目7总结
- [binary search] 4 Find the median of two positive arrays
- June training (the 26th day) - collective search
- Leetcode intermediate node of linked list
- Global and Chinese markets of children's electronic thermometers 2022-2028: Research Report on technology, participants, trends, market size and share
- 开发者,微服务架构到底是什么?
- Develop current learning objectives and methods
- Servlet learning notes II
猜你喜欢

量化投资学习——经典书籍介绍

Hcia-dhcp experiment

首批12家企业入驻!广州首个集中展销老字号产品专柜开张

Omni channel, multi scenario and cross platform, how does app analyze channel traffic with data

Standard implementation of streaming layout: a guide to flexboxlayout

Allocation de mémoire tas lors de la création d'objets

Appium automation test foundation - mobile end test environment construction (II)

Establishment of smart dialogue platform for wechat official account

Cmake / set command

exec系列函数(execl、execlp、execle、execv、execvp)使用
随机推荐
What is a botnet
Today's headline adaptation scheme code
哪些PHP开源作品值得关注
Global and Chinese market of contemporary lampshade 2022-2028: Research Report on technology, participants, trends, market size and share
[binary search] 4 Find the median of two positive arrays
Record the handling of oom problems caused by too many threads at one time
RDB持久化验证测试
Global and Chinese markets of children's electronic thermometers 2022-2028: Research Report on technology, participants, trends, market size and share
VS或Qt编译链接过程中出现“无法解析的外部符号”的原因:
搜索引擎高级搜索方法记录
MySQL项目7总结
Jar version conflict resolution
P1296 whispers of cows (quick row + binary search)
String constant pool, class constant pool, and runtime constant pool
MySQL 11th job - view application
When will JVM garbage collection enter the older generation
Write data to local file
Blog article index summary -- Software Engineering
Global and Chinese market of aluminum sunshade systems 2022-2028: Research Report on technology, participants, trends, market size and share
方法区里面有什么——class文件、class文件常量池、运行时常量池