当前位置:网站首页>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 ······
边栏推荐
- Do you know what the quotation for it talent assignment service is? It is recommended that programmers also understand
- Xunwei dry goods | Ruixin micro rk3568 development board TFTP & NFS writing (Part 1)
- 你知道IT人才外派服务报价是怎样的么?建议程序员也了解下
- []==! []
- QT script document translation (I)
- Esp32 learning notes (49) - esp-wifi-mesh interface use
- 网狐游戏服务器房间配置约战定制功能实现
- The difference between arrow function and ordinary function
- Leetcode hot topic 100 topic 21-25 solution
- Practice: how to reasonably design functions to solve practical problems in software development (I)
猜你喜欢

VTK vtkplane and vtkcutter use

Transformer Tracking

Web API、DOM

563. slope of binary tree

The difference between arrow function and ordinary function
![Quick sorting of graphic array [with source code]](/img/ef/b1b98db5b16f0c4efc8d3c5247e8b0.jpg)
Quick sorting of graphic array [with source code]

.NET C#基础(6):命名空间 - 有名字的作用域

client-go gin的简单整合六-list-watch二(关于Rs与Pod以及Deployment的完善)

迅为干货 |瑞芯微RK3568开发板TFTP&NFS烧写(上)

webserver
随机推荐
Open source cartoon server mango
The difference between TCP and UDP
网狐游戏服务器房间配置约战定制功能实现
洛谷P1091合唱队形(最长上升子序列)
Flutter 约束容器组件
Esp32 learning notes (49) - esp-wifi-mesh interface use
Required reading 1: the larger the pattern, the better they know how to speak
Quality-aware Feature Aggregation Networkfor Robust RGBT Tracking
Unity 全景漫游过程中使用AWSD控制镜头移动,EQ控制镜头升降,鼠标右键控制镜头旋转。
Check whether the filing information of the medical representative is correct
617. merge binary tree
Leetcode hot topic 100 topic 6-10 solution
【迅为干货】龙芯2k1000开发板opencv 测试
Transformer Tracking
Dynamic import
ESP32学习笔记(49)——ESP-WIFI-MESH接口使用
[deploy private warehouse based on harbor] 2 machine preparation
[probability theory and mathematical statistics] Dr. monkey's notes p41-44 statistics related topics, determination of three distributions, properties, statistics subject to normal distribution in gen
搜狐员工遭遇工资补助诈骗 黑产与灰产有何区别 又要如何溯源?
Records how cookies are carried in cross domain requests