MySql installation tutorial and how to use HeidiSQL management tools, and the use of SQL statements in HeidiSQL (6)

Mysql download path

Download address: https://dev.mysql.com/downloads/installer/
Select the offline installation package to download.
insert image description here
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
insert image description here

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
![Insert picture description here](https://img-blog.csdnimg.cn/37105c265a2349ac9d45c16d12522396.png

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.
insert image description here
Click the default to select self-growth,
remember to save after setting
insert image description here
insert image description here

insert image description here
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
insert image description here

Use of SQL statements in HeidiSQL

create database

desc tb_user;  

insert image description here

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 image description here

insert data into table

 INSERT into  tb_user(name,age,sex)values('珠珠',45,'女'),('王大年',55,'女'),('马治钊',23,'女');

insert image description here

Query the data in the table

select * from tb_user;
select name,age from tb_user;

insert image description here
insert image description here

View table structure

desc tb_user; 

insert image description here
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.

Guess you like

Origin blog.csdn.net/weixin_45496521/article/details/129769834