当前位置:网站首页>MySQL addition, deletion, modification, retrieval and constraint (detailed teaching)
MySQL addition, deletion, modification, retrieval and constraint (detailed teaching)
2022-07-24 16:51:00 【@_ Apes come like this】
As we all know, the premise of adding, deleting, modifying, searching and constraints is to create a database first , Then create a table in the database , Here is an example , This is the raw data of the table .
One 、 Add data
We need to add administrators 3、4、5,SQL The statement is as follows :
Refresh the table , And it worked .
Two 、 Delete data
For example, we want to delete the administrator 5,SQL The statement is as follows :

This indicates that the operation was successful .
3、 ... and 、 Modifying data
Will administrator 4 The password of is changed to 456123,SQL The statement is as follows :

Examples of success :

Four 、 Query data
Query Administrator 1 Information about , If it exists, query the information in the user table ,SQL The statement is as follows :
5、 ... and 、 retrieval ( The above figure is an example )
- Single column Select name from User table ;
- Multiple columns Select id,name from User table ;
- All columns Select*from User table ;
6、 ... and 、 constraint
1. Primary key constraint :
mysql>alter table User table
->ADD PRIMARY KEY (id);
2. Foreign key constraints :
mysql>ALTER TABLE Cashier structure
->ADD CONSTRAINT fk_ Commodity structure
->FOREIGN KEY (sum)
->REFERENCES Commodity structure (id);
3. Unique constraint :
mysql>ALTER TABLE User table
->ADD CONSTRAINT unique_id UNIQUE (id);
Pay attention to , Knowledge is not lost
边栏推荐
- IP的概念,IP的分类,IP复用技术
- JUC源码学习笔记3——AQS等待队列和CyclicBarrier,BlockingQueue
- jvm类加载子系统
- 15. ARM embedded system: how to debug single board with PC
- 【机器学习基础】——另一个视角解释SVM
- The third edition of New Horizon College English reading and Writing Tutorial 4 graduation examination site (units 1,2,3,5,6)
- Using native JS to realize magnifying glass function
- Interview question 01.02. determine whether it is character rearrangement
- Analysis of double pointer sliding window method and solution of leetcode related problems
- ArcGIS create vector
猜你喜欢
随机推荐
EF data migration
IP第十三天笔记
剑指 Offer 48. 最长不含重复字符的子字符串
What exactly is API?
Hping3 installation and use
IP day 13 notes
Buffer overflow vulnerability lab experiment record
thinkphp3.2.5无法跳转到外部链接
Wechat applet list (list rendering of data rendering)
AXI协议(2):AXI架构的五个通道和两种事务
1163: 松哥的分数拆分(C语言)
Sword finger offer 48. the longest substring without repeated characters
1184. Distance between bus stops
Sword finger offer 25. merge two sorted linked lists
QT QML virtual keyboard
Qsqldatabase: solution of qmmysql driver not loaded
15、ARM嵌入式系统:如何用PC调试单板
自定义类型:枚举
双亲委派机制
Explain Apache Hudi schema evolution in detail









