当前位置:网站首页>First day of database
First day of database
2022-06-11 07:00:00 【Yu Mei】
2021.6.15 Learn the first 60 God , Access to the database , stay node.js On the fifth day , I don't feel much ,nodejs It can be regarded as a backstage course , Why should the front end learn nodejs, It is natural to understand the front and rear interfaces , For a small project , use nodejs You can do it , There are also database operations , Simply put, it means adding, deleting, modifying, and querying , according to the understanding of , It's very important . A database is the place where data is stored , Then store the data with txt All right. , Why have databases ?
1. Basic concepts of database
1.1 What is a database
- database (database) It's for organizing 、 Warehouse for storing and managing data
- In order to facilitate the management of data in the Internet world , There is the concept of database management system ( abbreviation : database ). Users can add data in the database 、 Inquire about 、 to update 、 Delete and other operations
1.2 Common databases and classifications
- Common databases are divided into the following categories :
· MySQL database ( At present, it is most widely used 、 The most popular open source free database ;Community + Enterprise)
· Oracle database ( charge )
· SQL Server database ( charge )
· Mongodb database (Community + Enterprise) - Database classification
- Traditional database ( Relational database or SQL database )
· MySQL、Oracle、SQL Server, The design concepts of the three are the same , The usage is similar - New database ( Non relational database or NoSQL database )
· Mongodb, To some extent, it makes up for the defects of traditional database
- Traditional database ( Relational database or SQL database )
1.3 The data organization structure of traditional database
- In a traditional type of database , The organizational structure of data is divided into database (database)、 Data sheet (table)、 data row (row)、 Field (field) this 4 Most of the components

Concept object
* A database is similar to Excel The workbook for
* The data table is similar to Excel The worksheet for
* Data rows are similar to Excel Each row of data
* Fields are similar to Excel The column of
* Each field has a corresponding data type
1.4 Library in actual development 、 surface 、 That's ok 、 Field relationship
- In actual project development , In general , Each project corresponds to a separate database
- Different data , To store in different tables in the database , for example : User data is stored in users In the table , Store book data in books In the table
- What information is stored in each table , Determined by the field , for example : We can users Table design id、username、password this 3 A field
- The rows in the table , Represents each specific piece of data
2. install MySQL
2.1 Know what needs to be installed MySQL Related software
For developers , Just install MySQL Server and MySQL Workbench These two pieces of software , Can meet the needs of development
- MySQL Server: Software specifically designed to provide data storage and services
- MySQL Workbench: Visual MySQL Management tools , Through it , It can be easily operated and stored in MySQL Server Data in
2.2 MySQL stay Mac Installation in environment
stay Mac Installation in environment MySQL It's better than Windows The steps in the environment are much simpler
- First run mysql-8.0.19-macos10.15-x86_64.dmg This installation package , take MySQL Server The installation to Mac System
- Run again mysql-workbench-community-8.0.19-macos-x86_64.dmg This installation package , Will be visualized MySQL Workbench Install the tool to Mac System
- Specific installation tutorial , You can refer to mac System installation mysql database
2.3 MySQL stay Windows Installation in environment
- stay Windows Installation in environment MySQL, Just run mysql-installer-community-8.0.19.0.msi This installation package , You can put MySQL Server and MySQL Workbench Install on your own computer
- Specific installation tutorial , You can refer to win10 System installation mysql Methods
3.MySQL Basic use of
3.1 Use MySQL Workbench Management database
- Click on window key , Find all apps , Found installed MySQL Workbench, Click to
- Connect the database as shown

3.2 Create database
- Steps to create a database
- Click the create library button
- Fill in the name of the database
- Click on Apply Button , Create database
- Create database diagram

3.3 Create data table
Click on Table Table right key , Pop up create Table You can create a data table
3.4 Field name and data type of design table
DataType Common data types :
- int Integers
- varchar(len) character string
- tinyint(1) Boolean value
3.5 Set the special identification of the field
Set the special identification of the field
- PK(Primary Key) — Primary key 、 Unique identification
- NN(Not Null) — Value cannot be empty
- UQ(Unique) — It's worth it
- AI(Auto Increment) — The value increases automatically
Set the special identification of the field according to the figure

3.6 Write data to the table
Write data to the table as shown
4.SQL sentence
4.1 What is? SQL
- SQL yes Structured query language , A programming language designed to access and process databases . Can let us in the form of programming , Operate the data in the database
- Three key points :
- SQL Is a database programming language
- Use SQL Language code , be called SQL sentence
- SQL Language can only be used in relational databases ( for example MySQL、Oracle、SQL Server). Non relational database ( for example Mongodb) I won't support it SQL Language
4.2 SQL What can be done
- Query data from database
- Insert new data into the database
- Update the data in the database
- Delete data from database
- You can create a new database
- New tables can be created in the database
- You can create stored procedures in the database 、 View
See you next time ······
边栏推荐
- Wan Zichang's article shows you promise
- 【概率论与数理统计】猴博士 笔记 p41-44 统计量相关小题、三大分布的判定、性质、总体服从正态分布的统计量小题
- [deploy private warehouse based on harbor] 4 push image to harbor
- 通过 Ingress 进行灰度发布
- Flat design, blog website (VIII) code source code
- Leetcode-647.Palindromic Substrings
- Leetcode hot topic 100 topic 6-10 solution
- SQL语言-查询语句
- A promise with bare hands
- SQL language - query statement
猜你喜欢

socket. IO cross domain stepping pit

. Net C Foundation (6): namespace - scope with name

Do you know what the quotation for it talent assignment service is? It is recommended that programmers also understand

Do you use typescript or anyscript

Common troubleshooting tools and analysis artifacts are worth collecting

JVM from getting started to abandoning 1: memory model

Shutter restraint container assembly

1266_FreeRTOS调度器启动代码实现分析

latex 各种箭头/带文字标号的箭头/可变长箭头

【概率论与数理统计】猴博士 笔记 p41-44 统计量相关小题、三大分布的判定、性质、总体服从正态分布的统计量小题
随机推荐
JS implementation of Hill sort of graphic insertion sort [with source code]
538. convert binary search tree to cumulative tree
必读1:格局越大的人,越懂得说话
matplotlib的cmap
June training (day 11) - matrix
ESP32学习笔记(49)——ESP-WIFI-MESH接口使用
Redux learning (III) -- using Redux saga, writing middleware functions, and splitting reducer files
[MATLAB image fusion] particle swarm optimization adaptive multispectral image fusion [including source code phase 004]
Do you use typescript or anyscript
Common modules of saltstack
Appclips & tips (continuous update)
Whether the ZABBIX monitoring host is online
Do you know what the quotation for it talent assignment service is? It is recommended that programmers also understand
socket. IO cross domain stepping pit
洛谷P1091合唱队形(最长上升子序列)
【Matlab图像融合】粒子群优化自适应多光谱图像融合【含源码 004期】
Deep Attentive Tracking via Reciprocative Learning
[deploy private warehouse based on harbor] 3 deploy harbor
Leetcode-9.Palindrome Numbber
生物序列智能分析平台blog(1)