当前位置:网站首页>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 .
边栏推荐
- 统计遗传学:第二章,统计分析概念
- 手机注册股票开户 开户安全吗
- How does unity prevent other camera positions and rotations from being controlled by steamvrplugin when using steamvrplugin
- DD command tests the read and write speed of Huawei Kunpeng & Hongshan solid state storage disk
- I want to know how the top ten securities firms open accounts? Is online account opening safe?
- Redux related usage
- . Net, the usage of log components NLog, seriallog, log4net
- leetcode 715. Range module (hard)
- FasterRCNN
- What does ack attack mean? How to defend against ack attacks?
猜你喜欢

HUST network attack and defense practice | 6_ IOT device firmware security experiment | Experiment 3 freertos-mpu protection bypass

Nacos2.x.x start error creating bean with name 'grpcclusterserver';

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

19:第三章:开发通行证服务:2:在程序中,打通阿里云短信服务;(仅仅是打通阿里云短信服务器,不涉及具体的业务开发)

Machine learning LDA - Experimental Report

(typora picture bed) Alibaba cloud OSS building picture bed +picgo uploading picture detailed tutorial

科技兴关,荣联与天津海关共建基因组数据库及分析平台

机器学习深度神经网络——实验报告

HUST network attack and defense practice | 6_ IOT device firmware security experiment | Experiment 2 MPU based IOT device attack mitigation technology

9、 Beautify tables, forms, and hyperlinks
随机推荐
Machine Learning Clustering - Experimental Report
SolidWorks rendering tips how not to display edges -- display style settings
证券账户一般需要在哪里开通 开户安全吗
Statistical genetics: Chapter 1, basic concepts of genome
laravel-admin 用 原生JS实现声音提示,及自动播放
18:第三章:开发通行证服务:1:短信登录&注册流程,简介;(这儿使用短信验证码)
QT connection MySQL data query failed
Leetcode 78. 子集 and 90. 子集 II
What does ack attack mean? How to defend against ack attacks?
Laravel admin hidden button, and set button display, default sequence, form form form non modifiable value
Excel operation of manual moving average method and exponential smoothing method for time series prediction
我想知道同花顺是炒股的么?在线开户安全么?
Machine learning SVM - Experimental Report
laravel中使用group by分组并查询数量
laravel 安装报错 Uncaught ReflectionException: Class view does not exist
基于slate构建文档编辑器
Is it safe to open a stock account by mobile phone
Solidworks渲染技巧如何不显示边线--显示样式设定
女性科学家的流失
Code specification & explain in detail the functions and uses of husky, prettier, eslint and lint staged