当前位置:网站首页>1、 MySQL introduction
1、 MySQL introduction
2022-06-26 11:30:00 【Wayne830】
Indexes
1、 Database introduction
▲ Definition : database (Database, abbreviation DB) It's organized according to the data structure , Warehouse for storing and managing data .
▲ Characteristics and functions : On data Persistence The preservation of the ; Convenient data storage and query , Fast , Security , convenient ; Can handle concurrent access ; More secure rights management access mechanism .
▲ Definition of relational database and non relational database and common corresponding products
Relational database : use relational model To organize the storage of data , In the form of rows and columns ( surface ) Store data and record the relationship between data , You can maintain the relationship between data by establishing associations between tables . Its common products are :MySQL(MariaDB、Percona Server)、PostgreSQL、Oracle、SQL Server、Access、Sybase etc. .
for example : Student information -> Student list Class information -> Class table 
Non relational database : use Key value pair To store data , Only complete the recording of data , Relationships between data are not recorded . In a non relational database , Solve some big data application problems based on specific storage structure .NoSQL(Not Only SQL) To refer to non relational databases .
① Retrieval Oriented columnar storage (Column-Oriented) Non relational database :HaBase(Hadoop Subsystem )、BigTable(Google company ) etc.
② Cache storage for high concurrency (Key-value) Non relational database :Redis、MemcacheDB etc.
③ Documents for massive data access (Document-Oriented) Stored non relational database :MongoDB、CouchDB etc.
▲ Database terminology
data (Data): A symbolic record of things .
Relationship : A relation corresponds to a table as is often said .
Tuples : A row in the table is a tuple .
attribute : A column in the table is an attribute , Give each attribute a name, that is, the attribute name .
Database management system (DBMS): A layer of data management software between the user and the operating system .
Database system administrator (DBA): Responsible for database creation , Use and maintenance professionals .
Database system (DBS): Database administrator 、 Database management system and the whole unit of database .
2、SQL brief introduction
▲ Definition : Structured query language (Structed Query Language), For access 、 Inquire about 、 Update data and manage relational database system .
▲ Development :1981 Year by year IBM The company to launch , Once introduced, the syntax based on its introduction has been widely used in databases , Become the general specification of mainstream database . Later by ANSI The organization determines the specification , Compliance in different database products SQL General specifications , But also with SQL There are some differences , Proprietary instructions that form some databases .
▲ classification : from SQL Different database operations completed by instructions , Can be SQL There are four categories :DDL、DML、DQL、DCL
DDL(Data Definition Language): Data definition language , Used to complete the database object ( database 、 Data sheet 、 View 、 Index, etc. ) The creation of 、 Delete 、 modify .
DML(Data Manipulation Language): Data manipulation language , Used to add, delete, and modify data in the data table .
DQL(Data Query Language): Data query language , It is used to query the data in the data table .
DCL(Data Control Language): Data control language , Used to complete control operations such as transaction management .
▲ Basic grammatical principles
①SQL Instruction is not case sensitive .
② Every one of them SQL The instructions are written in ; end
③SQL Keywords in are separated by spaces .
④SQL There is no limit to line breaks in , That is, you can wrap lines where there are spaces .
3、 Relational algebra
Relationship model R( A 1 , A 2 , . . . , A n A_{1},A_{2},...,A_{n} A1,A2,...,An),t∈R Express t yes R A tuple of .t[ A i A_{i} Ai] Represents relative attributes in tuples A i A_{i} Ai Components of .
R by n Eye relations ,S by m Eye relations . t r ∈ R , t s ∈ S t_{r}∈R,t_{s}∈S tr∈R,ts∈S, Think t r t s t_{r}t_{s} trts Is the connection of tuples ( concatenated ), It is n+m Column tuple .
Image set : Given the relationship R(X,Z),X and Z For attribute group . When t[X]=x when ,x stay R The set of images is Z x Z_{x} Zx={t[Z]|t∈R,t[X]=x}.
Relational algebra is an abstract query language , Operations on relationships to express queries . The operations of relational algebra are as follows Operators are different Divided into traditional Set operations And specialized Relationship between operation Two types of .
① Traditional set operations
Set operations are binomial operations , contain and 、 Bad 、 hand over 、 Cartesian product operation . Assume two relationships R and S.
and :R∪S={t|t∈R∨t∈S}
hand over :R∩S={t|t∈R∧t∈S}
Bad :R-S={t|t∈R∧t∉S}
Cartesian product :R×S={ t r t s t_{r}t_{s} trts| t r ∈ R ∧ t s ∈ S t_{r}∈R∧t_{s}∈S tr∈R∧ts∈S}
② Special relational operations
Relational operations include choice 、 Projection 、 Connect 、 except operation .
choice : Also known as restriction . σ F ( R ) σ_{F}(R) σF(R)={t|t∈R∧F(t)=‘true’}. among F To choose conditions , Is a logical expression , Basic form XθY,θ Is a comparison operator or a logical operator .
Projection : Relationship R The projection on is from R Select several attribute columns to form a new relationship . Π A ( R ) Π_{A}(R) ΠA(R)={t[A]|t∈R}, among A by R Property column in .
Connect : Also known as θ Connect , From the Cartesian product of the two relations, the tuples satisfying certain conditions between tree types are selected . R ⋈ S A θ B R⋈S_{AθB} R⋈SAθB={ t r t s ∣ t r ∈ R ∧ t s ∈ S ∧ t r [ A ] θ t S [ B ] t_{r}t_{s}|t_{r}∈R∧t_{s}∈S∧t_{r}[A]θt_{S}[B] trts∣tr∈R∧ts∈S∧tr[A]θtS[B]}.
except : Relationship R(X,Y) and S(Y,Z), among X,Y,Z It's an attribute group .R Medium Y And S Can have different attribute names , But it has to come from the same set of domains .R÷S={ t r [ X ] ∣ t r ∈ R ∧ Π Y ( S ) ⊆ Y x t_{r}[X]|t_{r}∈R∧Π_{Y}(S)⊆Y_{x} tr[X]∣tr∈R∧ΠY(S)⊆Yx}.
▲ Examples of relational algebra :
https://www.bilibili.com/video/BV1JR4y1j78w?spm_id_from=333.999.0.0
4、 Use phpstudy Study MySQL
For reference :https://blog.csdn.net/qq_45735611/article/details/104820410
First step : Official website https://www.xp.cn/ download phpstudy, Select the destination folder for the download , Direct installation , Open after success phpstudy, And start the MySQL5.7.26 and Nginx1.15.11.
The second step : Click on " Set up ", Get into MySQL Folder .
The third step : Get into bin Folder , Copy path .
Step four : Right click this computer , choice " attribute ", open " Advanced system setup ", Click on " environment variable ", stay " System variables " Of PATH New China , Add the path copied in step 3 to . Click OK in all windows when exiting .

Step five : stay phpstudy Choose from " database ", Click on " modify root password " Change the password . The default password is root.
Step six :Win+R, Input cmd Call out command window , Input mysql -uroot -p Instructions , Enter the password reset in step 5 , Successfully logged in , Try typing show databases; Command to view an existing database .
Step seven : stay " Software management " in , install phpMyAdmin.
Step eight : After successful installation , stay " home page " in , open " Database tools ", choice phpMyAdmin, Enter the login interface . User name input root, Password enter the password reset in step 5 , That is, the login is successful .
边栏推荐
- One click deployment CEPH script
- APICloud 实现文档下载和预览功能
- 证券账户一般需要在哪里开通 开户安全吗
- FasterRCNN
- HUST network attack and defense practice | 6_ IOT device firmware security experiment | Experiment 2 MPU based IOT device attack mitigation technology
- Prospering customs through science and technology, Ronglian and Tianjin Customs jointly build a genomic database and analysis platform
- dd命令测试华为鲲鹏&宏衫固态存储磁盘读写速度
- 利用 Repository 中的方法解决实际问题
- laravel-admin 用 原生JS实现声音提示,及自动播放
- (Typora图床)阿里云oss搭建图床+Picgo上传图片详细教程
猜你喜欢

. Net, the usage of log components NLog, seriallog, log4net

How to prevent weight loss under Gao Bingfa?

深度理解STM32的串口实验(寄存器)【保姆级教程】

(Typora图床)阿里云oss搭建图床+Picgo上传图片详细教程

leetcode 715. Range module (hard)
![[Beiyou orchard microprocessor design] 10 serial communication serial communication notes](/img/61/b4cfb0500bbe39ed6a371bb8672a2f.png)
[Beiyou orchard microprocessor design] 10 serial communication serial communication notes

Flannel's host GW and calico

How does unity prevent other camera positions and rotations from being controlled by steamvrplugin when using steamvrplugin

【Redis 系列】redis 学习十六,redis 字典(map) 及其核心编码结构

机器学习线性回归——实验报告
随机推荐
深圳市福田区支持文化创意产业发展若干措施
证券账户可以开通 开户安全吗
Solidworks渲染技巧如何不显示边线--显示样式设定
FastRCNN
统计遗传学:第二章,统计分析概念
深度学习中的FLOPs和Params如何计算
flannel的host-gw与calico
Change calico network mode to host GW
Machine learning SVM - Experimental Report
Loggie encoding and newline character test
laravel-admin隐藏按钮, 及设置按钮显示, 默认序列, form 表单的不可修改值
【Redis 系列】redis 学习十六,redis 字典(map) 及其核心编码结构
express在nodejs中的基本使用
4、 Stacks and queues
HUST network attack and defense practice | 6_ IOT device firmware security experiment | Experiment 2 MPU based IOT device attack mitigation technology
Pratique de l'attaque et de la défense du réseau HUST | 6 Expérience de sécurité du microprogramme de l'équipement IOT | expérience 2 technologie d'atténuation des attaques de l'équipement IOT basée s
UDP flood attack defense principle
loggie 编码以及换行符测试
Machine learning LDA - Experimental Report
I want to know whether flush is a stock market? Is it safe to open a mobile account?