SQL语句

DDL:数据库定义语言(库、表的管理)

CREATE,DROP,ALTER

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |    ###虚拟库,用户信息
| mysql              |    ###授权库,用户权限信息
| performance_schema |    ###数据库性能参数
| sys                |    ###数据库性能参数
+--------------------+创建数据库
mysql> CREATE database Q;名字要求:1、区分大小写2、不能与命令相同3、不能纯数字、特殊符号进入数据库
mysql> USE node1;                    ###进入node1
Database changed
mysql> SELECT database();            ###查看所在库
+------------+
| database() |
+------------+
| node1      |
+------------+
1 row in set (0.00 sec)删除数据库
drop database Q;

建表
mysql> create table t1 (id int);
Query OK, 0 rows affected (0.03 sec)mysql> create table t2 (id int,name varchar(30));
Query OK, 0 rows affected (0.02 sec)查表
mysql> show tables;             ###显示表名
+-----------------+
| Tables_in_node1 |
+-----------------+
| t1              |
+-----------------+
1 row in set (0.01 sec)mysql> desc t2;                 ###显示表结构
+-------+-------------+------+-----+---------+-------+
| Field | Type        | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| id    | int         | YES  |     | NULL    |       |
| name  | varchar(30) | YES  |     | NULL    |       |
+-------+-------------+------+-----+---------+-------+mysql> select * from t2;         ###显示表内容
+------+------+
| id   | name |
+------+------+
|    1 | Q    |
|    2 | K    |
+------+------+
2 rows in set (0.00 sec)mysql> show create table student2\G           ###显示表属性
*************************** 1. row ***************************Table: student2
Create Table: CREATE TABLE `student2` (`name` varchar(5) DEFAULT NULL,`sex` enum('m','w') DEFAULT NULL,`job` set('worker','dancer','IT','teacher') DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
1 row in set (0.00 sec)删表
mysql> drop table t1;
Query OK, 0 rows affected (0.01 sec)

TYPE类型: 

一、数值类型
int——整数 unsigned-无符号型
mysql> create table test2 (int_test int unsigned,tinyint_test tinyint unsigned)
;
Query OK, 0 rows affected (0.01 sec)mysql> desc test2-> ;
+--------------+------------------+------+-----+---------+-------+
| Field        | Type             | Null | Key | Default | Extra |
+--------------+------------------+------+-----+---------+-------+
| int_test     | int unsigned     | YES  |     | NULL    |       |
| tinyint_test | tinyint unsigned | YES  |     | NULL    |       |
+--------------+------------------+------+-----+---------+-------+
2 rows in set (0.00 sec)zerofill-零填充
mysql> create table test3 (id int(6) zerofill,age int(10) zerofill);
Query OK, 0 rows affected, 4 warnings (0.02 sec)
mysql> desc test3;
+-------+---------------------------+------+-----+---------+-------+
| Field | Type                      | Null | Key | Default | Extra |
+-------+---------------------------+------+-----+---------+-------+
| id    | int(6) unsigned zerofill  | YES  |     | NULL    |       |
| age   | int(10) unsigned zerofill | YES  |     | NULL    |       |
+-------+---------------------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
mysql> select * from test3;
+--------+------------+
| id     | age        |
+--------+------------+
| 000023 | 0000000078 |
+--------+------------+
1 row in set (0.00 sec)float——小数,四舍五入
decimal——准确小数,直接放弃
mysql> create table test4 (sum float(5,3));                ###float(5位数,3位是小数)
Query OK, 0 rows affected, 1 warning (0.02 sec)mysql> desc test4;
+-------+------------+------+-----+---------+-------+
| Field | Type       | Null | Key | Default | Extra |
+-------+------------+------+-----+---------+-------+
| sum   | float(5,3) | YES  |     | NULL    |       |
+-------+------------+------+-----+---------+-------+
1 row in set (0.01 sec)
二、字符类型
char——255位
varchar——65535位
三、枚举、集合类型
enum——单选
set——多选mysql> create table student2 (name varchar(5),-> sex enum('m','w'),-> job set('worker','dancer','IT','teacher'));
Query OK, 0 rows affected (0.02 sec)mysql> insert into student2 values('K','w','worker,dancer');
Query OK, 1 row affected (0.00 sec)
四、时间类型
date——日期
time——时间
year——年
datetime——时间日期
timestamp——自动填充时间mysql> create table t6 (d date,t time,dt datetime);
Query OK, 0 rows affected (0.02 sec)mysql> insert into t6 values(now(),now(),now());            ###函数now(),系统当前时间
Query OK, 1 row affected, 1 warning (0.00 sec)mysql> select * from t6;
+------------+----------+---------------------+
| d          | t        | dt                  |
+------------+----------+---------------------+
| 2023-11-28 | 15:48:32 | 2023-11-28 15:48:32 |
+------------+----------+---------------------+
1 row in set (0.00 sec)

表约束

default——默认值
not null——不能为空
unsigned——无符号
zerofill——零填充
primary key——值不能重复、不能为空
auto_increment——自动按序填写
foreign key——同步父表主键与其他子表外键
unique——值不能重复、可以为空mysql> create table student3 (-> id int not null,-> name varchar(10) not null,-> sex enum('m','w') default'm',-> age int(3) unsigned not null;
Query OK, 0 rows affected, 1 warning (0.02 sec)mysql> desc student3;
+-------+---------------+------+-----+---------+-------+
| Field | Type          | Null | Key | Default | Extra |
+-------+---------------+------+-----+---------+-------+
| id    | int           | NO   |     | NULL    |       |
| name  | varchar(10)   | NO   |     | NULL    |       |
| sex   | enum('m','w') | YES  |     | m       |       |
| age   | int unsigned  | NO   |     | NULL    |       |
+-------+---------------+------+-----+---------+-------+
4 rows in set (0.00 sec)mysql> create table t1 (-> id int primary key auto_increment,        <<————-> name varchar(10) not null,-> sex enum('m','w') default'w');
Query OK, 0 rows affected (0.02 sec)
效果一样:
mysql> create table t1 (-> id int auto_increment,-> name varchar(10) not null,-> sex enum('m','w') default'w'),-> primary key (id));                        <<————mysql> desc t1;
+-------+---------------+------+-----+---------+----------------+
| Field | Type          | Null | Key | Default | Extra          |
+-------+---------------+------+-----+---------+----------------+
| id    | int           | NO   | PRI | NULL    | auto_increment |
| name  | varchar(10)   | NO   |     | NULL    |                |
| sex   | enum('m','w') | YES  |     | w       |                |
+-------+---------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)复合主键:
mysql> create table t2(-> id int auto_increment,-> name varchar(10) not null,-> sex enum('m','w') default'm',-> primary key(id,name));             <<————
mysql> desc t2;
+-------+---------------+------+-----+---------+----------------+
| Field | Type          | Null | Key | Default | Extra          |
+-------+---------------+------+-----+---------+----------------+
| id    | int           | NO   | PRI | NULL    | auto_increment |
| name  | varchar(10)   | NO   | PRI | NULL    |                |
| sex   | enum('m','w') | YES  |     | m       |                |
+-------+---------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)外键:
mysql> create table t1 (-> name varchar(10) primary key,-> mail varchar(20) not null,-> tel int(11) unsigned);
mysql> desc t1;
+-------+--------------+------+-----+---------+-------+
| Field | Type         | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+-------+
| name  | varchar(10)  | NO   | PRI | NULL    |       |
| mail  | varchar(20)  | NO   |     | NULL    |       |
| tel   | int unsigned | YES  |     | NULL    |       |
+-------+--------------+------+-----+---------+-------+
3 rows in set (0.00 sec)mysql> create table t2 (-> id int(3) auto_increment,-> name varchar(10) not null,-> payroll float(8,2) not null,-> primary key(id),-> foreign key(name) references t1(name) on update cascade on delete cascade); <<————
Query OK, 0 rows affected, 2 warnings (0.03 sec)mysql> desc t2;
+---------+-------------+------+-----+---------+----------------+
| Field   | Type        | Null | Key | Default | Extra          |
+---------+-------------+------+-----+---------+----------------+
| id      | int         | NO   | PRI | NULL    | auto_increment |
| name    | varchar(10) | NO   | MUL | NULL    |                |
| payroll | float(8,2)  | NO   |     | NULL    |                |
+---------+-------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)

DML:数据库操纵语言(数据的管理)

INSERT,DELETE,UPDATE

插入数据
mysql> insert into t2 values (1,"Q");        ###多个数据
Query OK, 1 row affected (0.00 sec)mysql> insert into t2 (name) values ('C');        ###指定数据
Query OK, 1 row affected (0.01 sec)mysql> insert into t2 values(3,'A'),(4,'B'),(5,'C');
Query OK, 3 rows affected (0.00 sec)
Records: 3  Duplicates: 0  Warnings: 0更新数据
mysql> update t1 set sex='w' where sex='m';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0mysql> update t2 set id=9 where name='C';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0删除数据
mysql> delete from t1 where name='K';           ###多个数据
Query OK, 1 row affected (0.00 sec)mysql> update t2 set id=null where name='Q';    ###指定数据
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

DQL:数据库查询语言

SELECT

一、简单查询
select * from t1;                    <<---查看所有列mysql> select id,name from t2;       <<---查看指定列
+----+------+
| id | name |
+----+------+
|  3 | H    |
|  2 | K    |
|  1 | Q    |
+----+------+
3 rows in set (0.00 sec)mysql> select name,payroll*9 from t2;        <<---结果加减乘除
+------+-----------+
| name | payroll*9 |
+------+-----------+
| Q    |   7200.00 |
| K    |   6030.00 |
| H    |   8100.00 |
+------+-----------+
3 rows in set (0.00 sec)二、条件查询
=,and,or,between and,in,likemysql> select name,mail from t1 where mail='K@123.com';        <<---单条件查询
+------+-----------+
| name | mail      |
+------+-----------+
| K    | K@123.com |
+------+-----------+
1 row in set (0.00 sec)mysql> select name,payroll from t2 where id='3' and payroll>700;    <<---and多条件查询
+------+---------+
| name | payroll |
+------+---------+
| H    |  900.00 |
+------+---------+
1 row in set (0.00 sec)mysql> select name,payroll from t2 where id='3' or payroll>700;    <<---or多条件查询
+------+---------+
| name | payroll |
+------+---------+
| Q    |  800.00 |
| H    |  900.00 |
+------+---------+
2 rows in set (0.00 sec)mysql> select name,payroll from t2 where payroll between 600 and 800;   <<---两个数之间
+------+---------+
| name | payroll |
+------+---------+
| Q    |  800.00 |
| K    |  670.00 |
+------+---------+
2 rows in set (0.00 sec)mysql> select name,payroll from t2 where payroll not between 600 and 800;   <<---两个数之外
+------+---------+
| name | payroll |
+------+---------+
| H    |  900.00 |
+------+---------+
1 row in set (0.00 sec)mysql> select name,payroll from t2 where payroll in(800,900);       <<---in多条件查询
+------+---------+
| name | payroll |
+------+---------+
| Q    |  800.00 |
| H    |  900.00 |
+------+---------+
2 rows in set (0.00 sec)mysql> select name,payroll from t2 where payroll not in(800,900);
+------+---------+
| name | payroll |
+------+---------+
| K    |  670.00 |
+------+---------+
1 row in set (0.00 sec)mysql> select name,tel from t1 where tel is null;        <<---查询空值
+------+------+
| name | tel  |
+------+------+
| M    | NULL |
+------+------+
1 row in set (0.00 sec)mysql> select name,tel from t1 where tel is not null;
+------+------+
| name | tel  |
+------+------+
| H    |  789 |
| K    |  456 |
| Q    |  123 |
+------+------+
3 rows in set (0.00 sec)mysql> select name,mail from t1 where mail like 'M@%';       <<---模糊查询
+------+-----------+
| name | mail      |
+------+-----------+
| M    | M@123.com |
+------+-----------+
1 row in set (0.00 sec)mysql> select name,mail from t1 where mail like '__123.com';    <<---1个下划线代表一个字符
+------+-----------+
| name | mail      |
+------+-----------+
| H    | H@123.com |
| K    | K@123.com |
| M    | M@123.com |
| Q    | Q@123.com |
+------+-----------+
4 rows in set (0.00 sec)三、查询排序
asc,desc,limitmysql> select * from t2 order by payroll asc;        <<---升序,默认
+----+------+---------+
| id | name | payroll |
+----+------+---------+
|  2 | K    |  670.00 |
|  1 | Q    |  800.00 |
|  3 | H    |  900.00 |
+----+------+---------+
3 rows in set (0.00 sec)mysql> select * from t2 order by payroll desc;        <<---降序
+----+------+---------+
| id | name | payroll |
+----+------+---------+
|  3 | H    |  900.00 |
|  1 | Q    |  800.00 |
|  2 | K    |  670.00 |
+----+------+---------+
3 rows in set (0.00 sec)mysql> select * from t2 order by payroll limit 2;        <<---前2行
+----+------+---------+
| id | name | payroll |
+----+------+---------+
|  2 | K    |  670.00 |
|  1 | Q    |  800.00 |
+----+------+---------+
2 rows in set (0.00 sec)四、多表查询
mysql> select t1.name,t1.tel,t2.payroll from t1,t2 where t1.name = t2.name;   <<---内连接,显示两表相同列的其他信息
+------+------+---------+
| name | tel  | payroll |
+------+------+---------+
| Q    |  123 |  800.00 |
| K    |  456 |  670.00 |
| H    |  789 |  900.00 |
+------+------+---------+
3 rows in set (0.00 sec)mysql> select t2.id,t1.name,t1.mail,t2.payroll        <<---左连接,先显示左表,再匹配-> from t1 left join t2                            ###left-> on t1.name = t2.name;                           ###匹配
+------+------+-----------+---------+
| id   | name | mail      | payroll |
+------+------+-----------+---------+
|    3 | H    | H@123.com |  900.00 |
|    2 | K    | K@123.com |  670.00 |
| NULL | M    | M@123.com |    NULL |
|    1 | Q    | Q@123.com |  800.00 |
+------+------+-----------+---------+
4 rows in set (0.00 sec)mysql> select t2.id,t1.name,t1.mail,t2.payroll        <<---右连接,先显示右表,再匹配-> from t1 right join t2                           ###right-> on t1.name = t2.name;                           ###匹配
+----+------+-----------+---------+
| id | name | mail      | payroll |
+----+------+-----------+---------+
|  1 | Q    | Q@123.com |  800.00 |
|  2 | K    | K@123.com |  670.00 |
|  3 | H    | H@123.com |  900.00 |
+----+------+-----------+---------+
3 rows in set (0.00 sec)mysql> select t2.id,t1.name from t1,t2;        <<---交叉连接,查询结果相乘
+----+------+
| id | name |
+----+------+
|  1 | H    |
|  2 | H    |
|  3 | H    |
|  1 | K    |
|  2 | K    |
|  3 | K    |
|  1 | M    |
|  2 | M    |
|  3 | M    |
|  1 | Q    |
|  2 | Q    |
|  3 | Q    |
+----+------+
12 rows in set (0.00 sec)五、复合使用
mysql> select t1.name,t1.mail,t2.id,t2.payroll        <<---左连接+and匹配-> from t1 left join t2-> on t1.name =t2.name                            ###第一次条件匹配-> and payroll >700;                              ###第二次条件匹配
+------+-----------+------+---------+
| name | mail      | id   | payroll |
+------+-----------+------+---------+
| H    | H@123.com |    3 |  900.00 |
| K    | K@123.com | NULL |    NULL |
| M    | M@123.com | NULL |    NULL |
| Q    | Q@123.com |    1 |  800.00 |
+------+-----------+------+---------+
4 rows in set (0.00 sec)mysql> select t1.name,t1.mail,t2.id,t2.payroll        <<---左连接+排序-> from t1 left join t2-> on t1.name = t2.name                           ###条件匹配-> order by id asc;                               ###结果排序
+------+-----------+------+---------+
| name | mail      | id   | payroll |
+------+-----------+------+---------+
| M    | M@123.com | NULL |    NULL |
| Q    | Q@123.com |    1 |  800.00 |
| K    | K@123.com |    2 |  670.00 |
| H    | H@123.com |    3 |  900.00 |
+------+-----------+------+---------+
4 rows in set (0.00 sec)mysql> select * from t1 where name                         ###然后根据匹配结果显示-> in (select name from t2 where payroll >700);        ###首先条件匹配
+------+-----------+------+
| name | mail      | tel  |
+------+-----------+------+
| Q    | Q@123.com |  123 |
| H    | H@123.com |  789 |
+------+-----------+------+
2 rows in set (0.00 sec)mysql> select * from t1 where-> exists (select * from t2 where payroll >1000);        ###条件不成立,输出空
Empty set (0.00 sec)mysql> select * from t1 where-> exists (select * from t2 where payroll >800);         ###条件成立,执行父句
+------+-----------+------+
| name | mail      | tel  |
+------+-----------+------+
| H    | H@123.com |  789 |
| K    | K@123.com |  456 |
| M    | M@123.com | NULL |
| Q    | Q@123.com |  123 |
+------+-----------+------+
4 rows in set (0.00 sec)

DCL:数据库控制语言(权限管理)

GRANT,REVOKE

创建用户
mysql> create user tom@'localhost' identified by 'Tom@123.com';
Query OK, 0 rows affected (0.01 sec)mysql> select * from mysql.user\G;        ###查看用户删除用户
mysql> drop user tom@'localhost';
Query OK, 0 rows affected (0.01 sec)修改密码
mysql> alter user 'root'@'localhost' identified by 'JKzone@123456';
Query OK, 0 rows affected (0.01 sec)mysql> flush privileges;                        ###加载配置
Query OK, 0 rows affected (0.00 sec)登录参数
[root@node1 ~]# mysql -uroot -p -P 3306            ###指定端口
Enter password: [root@node1 ~]# mysql -uroot -p school             ###指定数据库
Enter password: [root@node1 ~]# mysql -utom -p -h 192.168.1.2;     ###远程登录
Enter password: [root@node1 ~]# mysql -uroot -p'JKzone@123' -e "show databases;"        <<---不登录执行命令
mysql: [Warning] Using a password on the command line interface can be insecure.
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| node1              |
| performance_schema |
| school             |
| sys                |
+--------------------+授权管理
mysql> grant all on node1.* to tom@'localhost';        ###授权本地登录,管理node1库
Query OK, 0 rows affected (0.01 sec)mysql> grant all on node1.* to tom@'192.168.1.%';        ###个别网段登录
Query OK, 0 rows affected (0.01 sec)mysql> grant select,update on school.test3 to tom@'localhost';        ###指定查询、更新权限
Query OK, 0 rows affected (0.00 sec)mysql> grant select(id,age) on school.test3 to tom@'localhost';       ###指定列权限
Query OK, 0 rows affected (0.00 sec)查看授权
mysql> show grants\G                                <<---当前用户
*************************** 1. row ***************************
Grants for tom@112.74.52.%: GRANT USAGE ON *.* TO `tom`@`112.74.52.%`
1 row in set (0.00 sec)mysql> show grants for mary@'localhost';            <<---指定用户
+-------------------------------------------------------------+
| Grants for mary@localhost                                   |
+-------------------------------------------------------------+
| GRANT USAGE ON *.* TO `mary`@`localhost`                    |
| GRANT ALL PRIVILEGES ON `school`.`t2` TO `mary`@`localhost` |
+-------------------------------------------------------------+
2 rows in set (0.00 sec)回收授权
mysql> revoke all on school.t2 from mary@'localhost';
Query OK, 0 rows affected (0.00 sec)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/189208.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

iOS简单理解区分MVC、MVP、MVVM

MVC、MVP、MVVM 前言 这篇文章简单介绍MVC、MVP和MVVM三种架构&#xff0c;并配上一个简单的Swift demo来区分MVC和MVVM两种架构。 MVC 传统MVC 下图是传统结构MVC&#xff0c;可以看到这种结构是紧耦合的&#xff0c;不推荐使用。 苹果的MVC 如下图&#xff0c;这是苹果…

AI产业前瞻报告:探讨GPTs背后的产业逻辑:拉开AIGC应用生态的帷幕

今天分享的是AI系列深度研究报告&#xff1a;《AI产业前瞻报告&#xff1a;探讨GPTs背后的产业逻辑&#xff1a;拉开AIGC应用生态的帷幕》。 &#xff08;报告出品方&#xff1a;光大证券&#xff09; 报告共计&#xff1a;13页 1、GPTs 拉开 AIGC 应用生态的帷幕 1.1、 Ope…

【开题报告】基于SpringBoot的护肤交流分享平台的设计与实现

1.选题背景 随着社会发展和生活水平提高&#xff0c;人们对于美容护肤的需求越来越高。由于护肤知识需要不断更新和积累&#xff0c;很多用户需要寻找可信赖的护肤信息和经验分享。传统的社交媒体平台虽然可以满足一部分用户的需求&#xff0c;但是缺乏专业性和可靠性&#xf…

系列二十二、各种注解

一、Import # 用法 1&#xff09;Import(User.class)&#xff1a;如果导入的是配置类&#xff0c;将会按照配置类正常解析&#xff0c;如果是个普通类就会解析成bean 2&#xff09;Import&#xff08;实现了ImportSelector接口的类.class&#xff09;&#xff1a;可以一次性注册…

Python爬虫基础之Scrapy框架详解

目录 1. 简介2. Scrapy的安装3. Scrapy的架构4. Scrapy的数据流程5. Scrapy开发流程5.1 创建项目5.2 创建Spider5.3 创建Item5.4 编写Spider5.5 运行Spider 参考文献 原文地址&#xff1a;https://program-park.top/2023/12/01/reptile_5/ 本文章中所有内容仅供学习交流使用&am…

0Ω电阻最大过流能力及作用用途

0Ω电阻最大过流能力及作用用途 0Ω电阻过流能力0Ω电阻的作用 0Ω电阻过流能力 0Ω电阻不一定是真正的0Ω电阻&#xff0c;0Ω电阻存在一定的阻值偏差&#xff0c;主要看生产电阻厂商做哪种了。厂商都是根据电阻标准文件 EN60115-2&#xff0c; 里头0Ω电阻实际最大阻值有 10…

第六十四周周报

学习目标&#xff1a; 项目 实验 学习时间&#xff1a; 2023.11.24-2023.12.1 学习产出&#xff1a; 项目 由于小程序要上线了&#xff0c;这周前几天都在和前端联调改bug&#xff0c;并且多拆分出来两张表&#xff0c;工作量比较大&#xff0c;花的时间很多。 实验 整…

JAVA全栈开发 day15_集合(Set接口、增强For循环、Map体系)

一、增加for遍历集合 语法&#xff1a; for(数据类型 变量名: 数组名或集合){​ }//集合遍历 &#xff0c;推荐使用增加for 1.静态导入 注意事项&#xff1a; 方法必须是静态注意不要和本类的方法同名&#xff0c;如果同名&#xff0c;记得加前缀&#xff0c;由此可…

error: flexible array member not at end of struct 柔性数组/可变数组

在C之中&#xff0c;给定了一个结构定义和一个指向结构的指针&#xff0c;编译器必须能够通过指针偏移的方式访问该结构的任何成员。由于结构中每个成员的位置都取决于其前导成员的数量和类型&#xff0c;因此访问任何结构都需要知道所有前导成员的数量和类型。 在结构体之中&…

Git——分支应用进阶

主要内容包括以下几个方面&#xff1a; 长期分支和短期分支的类型以及用途。多种分支模型&#xff0c;其中包括基于工作流的主题分支。不同分支模型的发布流程。在多个预览版程序中使用分支修复安全问题。远程跟踪分支和refspecs规范&#xff0c;以及默认远程版本库配置。拉取…

Mongodb 开启oplog,java监听oplog并写入关系型数据库

开启Oplog windows mongodb bin目录下找到配置文件/bin/mongod.cfg,配置如下&#xff1a; replication:replSetName: localoplogSizeMB: 1024双击mongo.exe 执行 rs.initiate({_id: "local", members: [{_id: 0, host: "localhost:27017"}]})若出现如…

深入理解前端路由:构建现代 Web 应用的基石(下)

&#x1f90d; 前端开发工程师&#xff08;主业&#xff09;、技术博主&#xff08;副业&#xff09;、已过CET6 &#x1f368; 阿珊和她的猫_CSDN个人主页 &#x1f560; 牛客高级专题作者、在牛客打造高质量专栏《前端面试必备》 &#x1f35a; 蓝桥云课签约作者、已在蓝桥云…

多线程(初阶六:单例模式)

一、单例模式的简单介绍 二、饿汉模式 三、懒汉模式 四、饿汉模式和懒汉模式的线程安全问题分析 一、单例模式的简单介绍 单例模式是一种设计模式&#xff0c;其中设计模式是软性的规定&#xff0c;与它关联的框架是硬性的规定&#xff0c;这些都是大佬已经设计好了的&…

feign自定义第三方接口;配置化Feign接口URL;调用指定IP的feign服务

最近接手一个项目&#xff0c;各子工程之间通过feign调用&#xff1b;各服务部署在K8S上&#xff0c;通过nacos管理配置&#xff1b;由于服务部署的机器无法开放端口等原因&#xff0c;导致本机服务与测试环境网络端口无法互通&#xff0c;故需要重写feign的调用地址&#xff1…

QT线程的使用 循环中程序的等待

QT线程的使用 循环中程序的等待 先看效果1 pro文件2 头文件3 源文件4 ui文件先看效果 1 pro文件 QT += concurrent2 头文件 #ifndef MAINWINDOW_H #define MAINWINDOW_H

简述MyBatis、MyBatis-Plus、以及MyBatis-Plus的简单运用

什么是MyBatis MyBatis是一个开源的Java持久层框架&#xff0c;用于简化与关系型数据库的交互。它通过将SQL语句与Java代码进行分离&#xff0c;提供了一种优雅的方式来处理数据库操作。 MyBatis的核心思想是将SQL语句与Java方法进行映射&#xff0c;使得开发人员可以通过配置…

集成开发环境PyCharm的使用【侯小啾python领航计划系列(三)】

集成开发环境 PyCharm 的使用【侯小啾python领航计划系列(三)】 大家好,我是博主侯小啾, 🌹꧔ꦿ🌹꧔ꦿ🌹꧔ꦿ🌹꧔ꦿ🌹꧔ꦿ🌹꧔ꦿ🌹꧔ꦿ🌹꧔ꦿ🌹꧔ꦿ🌹꧔ꦿ🌹꧔ꦿ🌹꧔ꦿ🌹꧔ꦿ🌹꧔ꦿ🌹꧔ꦿ🌹꧔ꦿ🌹꧔ꦿ🌹꧔ꦿ🌹꧔ꦿ🌹꧔ꦿ🌹꧔ꦿ�…

【Vue3+Ts项目】硅谷甄选 — 搭建后台管理系统模板

一、 项目初始化 一个项目要有统一的规范&#xff0c;需要使用eslintstylelintprettier来对我们的代码质量做检测和修复&#xff0c;需要使用husky来做commit拦截&#xff0c;需要使用commitlint来统一提交规范&#xff08;即统一提交信息&#xff09;&#xff0c;需要使用pre…

剑指 Offer(第2版)面试题 12:矩阵中的路径

剑指 Offer&#xff08;第2版&#xff09;面试题 12&#xff1a;矩阵中的路径 剑指 Offer&#xff08;第2版&#xff09;面试题 12&#xff1a;矩阵中的路径解法1&#xff1a;回溯 剑指 Offer&#xff08;第2版&#xff09;面试题 12&#xff1a;矩阵中的路径 题目来源&#x…

Python | 轻量ORM框架Peewee的基础使用(增删改查、自动创建模型类、事务装饰器)

文章目录 01 简介02 安装03 自动创建模型类04 基础使用4.1 查询4.2 新增4.3 更新4.4 删除 05 事务 01 简介 在使用python开发的过程中&#xff0c;有时需要一些简单的数据库操作&#xff0c;而Peewee正是理想的选择&#xff0c;它是一个小巧而灵活的 Python ORM&#xff08;对…