当前位置:网站首页>MySQL Foundation
MySQL Foundation
2022-07-02 23:30:00 【pengege666】
1. Database related concepts
1.1 Database concept : Warehouse for storing and managing data , Data is organized and stored . database (DataBase, abbreviation DB) Is to store the data on the hard disk , It can achieve the effect of persistent storage .
1.2 Database management system : Large software for managing databases (DataBase Management System, abbreviation DBMS)
explain : After installing the database management system on the computer , You can create a database through the database management system to store data , You can also add, delete, modify and query the data in the database through the system . That's what we talk about MySQL The database is actually MySQL Database management system .
1.3 Common database management system
Oracle: A large database of charges ,Oracle Products of the company
MySQL: Open source free small and medium-sized databases . later Sun The company acquired MySQL, and Sun The company was again Oracle Acquisition
SQL Server:MicroSoft A database of medium-sized companies that charge .C#、.net Such language is often used
PostgreSQL: Open source free small and medium-sized databases
DB2:IBM The company's large charging database products
SQLite: Embedded micro database . Such as : As Android Built in database
MariaDB: Open source free small and medium-sized databases
1.4 SQL
- english :Structured Query Language, abbreviation SQL, Structured query language
- Programming language for operating relational databases
- Define a unified standard for operating all relational databases , have access to SQL Operate all relational database management systems , in the future If other database management systems are used in the work , Use the same SQL To operate .
2.MySQL
2.1 install A little ...
2.2 MySQL Data model
Relational database :
A relational database is a database based on a relational model , In short , Relational database is made up of several pieces that can be connected with each other Two-dimensional table Composed database
Data model :


Summary :
- MySQL You can create multiple databases in , Each database corresponds to a folder on disk
- Multiple tables can be created in each database , Each corresponds to a... On disk frm file
- Each table can store multiple pieces of data , The data will be stored on disk MYD In file
3.SQL
- english :Structured Query Language, abbreviation SQL
- Structured query language , A programming language for operating relational databases
- Define a unified standard for operating all relational databases
- For the same need , There may be some differences in each way of database operation , We call it “ dialect ”
DDL(Data Definition Language) : Data definition language , Used to define database objects : database , surface , Column, etc.
DDL Simple understanding is used to operate the database , Table, etc 
DML(Data Manipulation Language) Data operation language , It is used to add, delete and modify the data in the database
DML Simply understand and add, delete and modify the data in the table .

DQL(Data Query Language) Data query language , Used to query the records of tables in the database ( data )
DQL The simple understanding is to query the data . Query the data we want from the database table .
DCL(Data Control Language) Data control language , It is used to define the access rights and security level of the database , And create users
DML The simple understanding is to control the permissions of the database . For example, I let a database table be operated by only one user .
Be careful : The most common thing we will do in the future is DML and DQL , Because the most common operation in our development is data .
DDL
1. Operating the database
1. Query all databases
SHOW DATABASES;
2. Create database
CREATE DATABASE Database name ;
3. Delete database
DROP DATABASE Database name ;
4. Using a database
USE Database name ;
5. View currently used databases
SELECT DATABASE();
2. Operation data sheet
1. Query the names of all tables in the current database
SHOW TABLES;
2. Query table structure
DESC The name of the table ;
3. Create table
CREATE TABLE Table name (
Field name 1 data type 1,
Field name 2 data type 2,
…
Field name n data type n
);
4. Delete table
DROP TABLE Table name ;
5. Modify the name of the table
ALTER TABLE Table name RENAME TO New table name ;
6. Add a column
ALTER TABLE Table name ADD Name data type ;
7. Change data type
ALTER TABLE Table name MODIFY Name New data types ;
8. Change column name and data type
ALTER TABLE Table name CHANGE Name New column names New data types ;
9. Delete column
ALTER TABLE Table name DROP Name ;
DML
DML It mainly increases the data (insert) Delete (delete) Change (update) operation .
1. Add data
1.1 Add data to the specified column
INSERT INTO Table name ( Name 1, Name 2,…) VALUES( value 1, value 2,…);
1.2 Add data to all columns
INSERT INTO Table name VALUES( value 1, value 2,…);
1.3 Batch add data
INSERT INTO Table name ( Name 1, Name 2,…) VALUES( value 1, value 2,…),( value 1, value 2,…),( value 1, value 2,…)…;
2. Modifying data
2.1 Modify table data
UPDATE Table name SET Name 1= value 1, Name 2= value 2,… [WHERE Conditions ] ;
3. Delete data
3.1 Delete data
DELETE FROM Table name [WHERE Conditions ] ;
DQL
SELECT
Field list
FROM
List of table names
WHERE
List of conditions
GROUP BY
Grouping field
HAVING
Conditions after grouping
ORDER BY
Sort field
LIMIT
Paging limit
边栏推荐
- Ideal car × Oceanbase: when the new forces of car building meet the new forces of database
- Where is the win11 automatic shutdown setting? Two methods of setting automatic shutdown in win11
- Which common ports should the server open
- SharedPreferences save list < bean > to local and solve com google. gson. internal. Linkedtreemap cannot be cast to exception
- Fusion de la conversion et de la normalisation des lots
- Tronapi wave field interface - source code without encryption - can be opened twice - interface document attached - packaging based on thinkphp5 - detailed guidance of the author - July 1, 2022 08:43:
- “一个优秀程序员可抵五个普通程序员!”
- Detailed explanation of 'viewpager' in compose | developer said · dtalk
- [live broadcast appointment] database obcp certification comprehensive upgrade open class
- 高数有多难?AI 卷到数学圈,高数考试正确率 81%!
猜你喜欢

What experience is there only one test in the company? Listen to what they say

Tiktok actual combat ~ number of likes pop-up box

Why does RTOS system use MPU?

Golang common settings - modify background

Intranet penetration | teach you how to conduct intranet penetration hand in hand

解决:exceptiole ‘xxxxx.QRTZ_LOCKS‘ doesn‘t exist以及mysql的my.cnf文件追加lower_case_table_names后启动报错

一文掌握基于深度学习的人脸表情识别开发(基于PaddlePaddle)
![Temperature measurement and display of 51 single chip microcomputer [simulation]](/img/83/73ee7f87787690aef7f0a9dab2c192.jpg)
Temperature measurement and display of 51 single chip microcomputer [simulation]

购买完域名之后能干什么事儿?

What can I do after buying a domain name?
随机推荐
面试过了,起薪16k
php 获取真实ip
Li Kou brush questions (2022-6-28)
Win11自动关机设置在哪?Win11设置自动关机的两种方法
SQL advanced syntax
Redis expiration policy +conf record
@How to use bindsinstance in dagger2
Potplayer set minimized shortcut keys
Print out mode of go
内网渗透 | 手把手教你如何进行内网渗透
All things work together, and I will review oceanbase's practice in government and enterprise industry
潘多拉 IOT 开发板学习(HAL 库)—— 实验4 串口通讯实验(学习笔记)
VIM interval deletion note
Yolox enhanced feature extraction network panet analysis
Use the scroll bar of souI when using the real window in souI
Third party payment function test point [Hangzhou multi tester _ Wang Sir] [Hangzhou multi tester]
Remote connection of raspberry pie by VNC viewer
简述中台的常识
【ML】李宏毅三:梯度下降&分类(高斯分布)
Three solutions to frequent sticking and no response of explorer in win11 system