当前位置:网站首页>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
边栏推荐
- CDN 加速,需要域名先备案
- 密码技术---密钥和SSL/TLS
- Intranet penetration | teach you how to conduct intranet penetration hand in hand
- 内网渗透 | 手把手教你如何进行内网渗透
- Brief introduction to common sense of Zhongtai
- Agnosticism and practice makes perfect
- All things work together, and I will review oceanbase's practice in government and enterprise industry
- [proteus simulation] 51 MCU +lcd12864 push box game
- BBR encounters cubic
- 海思调用接口之Makefile配置
猜你喜欢
Win11麦克风测试在哪里?Win11测试麦克风的方法
Mapper代理开发
PotPlayer设置最小化的快捷键
Realize the linkage between bottomnavigationview and navigation
[ml] Li Hongyi III: gradient descent & Classification (Gaussian distribution)
The use of 8255 interface chip and ADC0809
BBR encounters cubic
Explain promise usage in detail
Eight honors and eight disgraces of the programmer version~
Introduction to the latest plan of horizon in April 2022
随机推荐
Fusion de la conversion et de la normalisation des lots
Go project operation method
I've been interviewed. The starting salary is 16K
vim区间删行注释
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:
潘多拉 IOT 开发板学习(HAL 库)—— 实验3 按键输入实验(学习笔记)
@How to use bindsinstance in dagger2
Cryptography -- the mode of block cipher
采用VNC Viewer方式远程连接树莓派
LINQ usage collection in C #
Strictly abide by the construction period and ensure the quality, this AI data annotation company has done it!
Solution: exceptiole 'xxxxx QRTZ_ Locks' doesn't exist and MySQL's my CNF file append lower_ case_ table_ Error message after names startup
Third party payment function test point [Hangzhou multi tester _ Wang Sir] [Hangzhou multi tester]
golang入门:for...range修改切片中元素的值的另类方法
Markdown basic grammar
All things work together, and I will review oceanbase's practice in government and enterprise industry
Win11如何开启目视控制?Win11开启目视控制的方法
CDN 加速,需要域名先备案
Convolution和Batch normalization的融合
[redis notes] compressed list (ziplist)