Article directory
Mysql download path
Download address: https://dev.mysql.com/downloads/installer/
Select the offline installation package to download.
There are many detailed installation tutorials on the Internet, and you can install it as needed.
After the installation is complete, win+r opens services.msc to check whether the MySql service is enabled
Mysql management tool – HeidiSQL download
The management tool can help you understand the database structure at a glance when connecting to the program. You can test whether your sql statement is correct in this tool first, helping you find bugs faster and complete function implementation as soon as possible.
HeidiSQL can be downloaded directly from the official website.
You can also directly download the installation package under this link for installation.
https://pan.baidu.com/s/1r3PhyvPuxofkuoPxzWqqoA Extraction code: 8888
After the installation is complete, you can test and edit the sql statement
After successful login,
click Query – write sql statement – click Execute to test,
and the result will be prompted at the bottom
Set the primary key to grow automatically
Right-click to select the primary key row to be set, and click key to set the primary key.
Click the default to select self-growth,
remember to save after setting
Click Data – Refresh to check whether the primary key is successful or not. Note that the primary key does not need to be assigned in sql
Use of SQL statements in HeidiSQL
create database
desc tb_user;
Drop and create tables
drop table if exists tableName;//删除整个表结构与所有数据
// 创建表
create table tb_user(
id int comment '用户id',
name varchar(50) comment '用户名称',
age int,
sex varchar(1)
);
insert data into table
INSERT into tb_user(name,age,sex)values('珠珠',45,'女'),('王大年',55,'女'),('马治钊',23,'女');
Query the data in the table
select * from tb_user;
select name,age from tb_user;
View table structure
desc tb_user;
For other SQL statements, please refer to https://blog.csdn.net/weixin_45496521/article/details/128851308 , pay attention to the spelling of keywords, fields, database names, table names, etc.