当前位置:网站首页>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 .
边栏推荐
- 再获认可!知道创宇入选“业务安全推进计划”首批成员单位
- Re recognized! Know that Chuangyu has been selected as one of the first member units of the "business security promotion plan"
- 3、 Linked list exercise
- Ctfshow web getting started command execution web75-77
- Pre knowledge of hash table -- binary search tree
- Sqli labs range 1-5
- sliding window
- Code specification & explain in detail the functions and uses of husky, prettier, eslint and lint staged
- MOS管基本原理,单片机重要知识点
- Loggie encoding and newline character test
猜你喜欢

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

Redis的最佳实践?看完不心动,算我输!!
![[deep learning theory] (7) long and short term memory network LSTM](/img/fb/57781998390e0722df68e6c2e49098.gif)
[deep learning theory] (7) long and short term memory network LSTM

机器学习线性回归——实验报告

HUST网络攻防实践|6_物联网设备固件安全实验|实验二 基于 MPU 的物联网设备攻击缓解技术

redux相关用法

TCP面试

PC QQ hall upload update modify VersionInfo

Svn installation configuration

matlab 编程实例: 如何统计元胞数组中元素的数量
随机推荐
MQTT断开重连
openresty 概述
Lintcode 130 · 堆化
Sqli labs range 1-5
APICloud 实现文档下载和预览功能
This paper introduces the simple operation of realizing linear quadratic moving average of time series prediction that may be used in modeling and excel
Loggie encoding and newline character test
我想知道同花顺是炒股的么?手机开户安全么?
Detailed explanation of MySQL fuzzy query
FastRCNN
我想知道,十大劵商如何开户?在线开户安全么?
24 database interview questions that must be mastered!
SolidWorks rendering tips how not to display edges -- display style settings
laravel 安装报错 Uncaught ReflectionException: Class view does not exist
laravel-admin 用 原生JS实现声音提示,及自动播放
哈希表的前置知识---二叉搜索树
PC QQ hall upload update modify VersionInfo
机器学习LDA——实验报告
How does unity prevent other camera positions and rotations from being controlled by steamvrplugin when using steamvrplugin
Redis best practices? If I don't feel excited after reading it, I will lose!!