当前位置:网站首页>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
边栏推荐
- 提交代码流程
- [proteus simulation] 51 MCU +lcd12864 push box game
- Win11如何开启目视控制?Win11开启目视控制的方法
- Ideal car × Oceanbase: when the new forces of car building meet the new forces of database
- Talk about memory model and memory order
- Numerical solution of partial differential equations with MATLAB
- Interface switching based on pyqt5 toolbar button -1
- 程序员版本的八荣八耻~
- 解决:exceptiole ‘xxxxx.QRTZ_LOCKS‘ doesn‘t exist以及mysql的my.cnf文件追加lower_case_table_names后启动报错
- Golang common settings - modify background
猜你喜欢

C# MVC创建一个视图摆脱布局的影响

C#中Linq用法汇集

Print out mode of go

Win11麦克风测试在哪里?Win11测试麦克风的方法

What if win11 can't turn off the sticky key? The sticky key is cancelled but it doesn't work. How to solve it

Integration of revolution and batch normalization

采用VNC Viewer方式远程连接树莓派
![[live broadcast appointment] database obcp certification comprehensive upgrade open class](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[live broadcast appointment] database obcp certification comprehensive upgrade open class

LINQ usage collection in C #

I've been interviewed. The starting salary is 16K
随机推荐
[error record] the flutter reports an error (could not resolve io.flutter:flutter_embedding_debug:1.0.0.)
Win11自动关机设置在哪?Win11设置自动关机的两种方法
Editor Caton
Intranet penetration | teach you how to conduct intranet penetration hand in hand
Boost库链接错误解决方案
[live broadcast appointment] database obcp certification comprehensive upgrade open class
可知论与熟能生巧
Arduino - character judgment function
Remote connection of raspberry pie by VNC viewer
golang中new与make的区别
内网渗透 | 手把手教你如何进行内网渗透
潘多拉 IOT 开发板学习(HAL 库)—— 实验4 串口通讯实验(学习笔记)
ADC of stm32
Go basic anonymous variable
LINQ usage collection in C #
Golang common settings - modify background
抖音实战~点赞数量弹框
[ml] Li Hongyi III: gradient descent & Classification (Gaussian distribution)
SQL进阶语法
Cryptography -- the mode of block cipher