[JavaWeb]【七】web后端開發-MYSQL

前言:MySQL是一種流行的關系型數據庫管理系統,它的作用是存儲和管理數據。在Web開發中,MySQL是必備的數據庫技能之一,因為它可以幫助Web開發人員處理大量的數據,并且提供了強大的數據查詢和管理功能。

一 數據庫介紹

1.1 什么是數據庫

?1.2 數據庫產品

二 MySQL概述

2.1 下載

點開下面的鏈接:https://dev.mysql.com/downloads/mysql/

點擊Download 就可以下載對應的安裝包了, 安裝包如下:

2.2 解壓

下載完成后我們得到的是一個壓縮包,將其解壓,我們就可以得到MySQL 8.0.31 的軟件本體了(就是一個文件夾),我們可以把它放在你想安裝的位置 。

2.3 配置

2.3.1. 添加環境變量

環境變量里面有很多選項,這里我們只用到Path這個參數。為什么在初始化的開始要添加環境變量呢?

在黑框(即CMD)中輸入一個可執行程序的名字,Windows會先在環境變量中的Path所指的路徑中尋找一遍,如果找到了就直接執行,沒找到就在當前工作目錄找,如果還沒找到,就報錯。我們添加環境變量的目的就是能夠在任意一個黑框直接調用MySQL中的相關程序而不用總是修改工作目錄,大大簡化了操作。

右鍵此電腦屬性,點擊高級系統設置

點擊環境變量

系統變量中新建MYSQL_HOME

系統變量中找到并雙擊Path

點擊新建

?最后點擊確定。

如何驗證是否添加成功?

右鍵開始菜單(就是屏幕左下角),選擇命令提示符(管理員),打開黑框,敲入mysql,回車。

如果提示Can't connect to MySQL server on 'localhost'則證明添加成功;

如果提示mysql不是內部或外部命令,也不是可運行的程序或批處理文件則表示添加添加失敗,請重新檢查步驟并重試。

2.3.2. 初始化MySQL

==以管理員身份,運行命令行窗口:==

在剛才的命令行中,輸入如下的指令:

mysqld --initialize-insecure

稍微等待一會,如果出現沒有出現報錯信息,則證明data目錄初始化沒有問題,此時再查看MySQL目錄下已經有data目錄生成。

tips:如果出現如下錯誤

是由于權限不足導致的,以管理員方式運行 cmd

2.3.3. 注冊MySQL服務

命令行(注意必須以管理員身份啟動)中,輸入如下的指令,回車執行:

mysqld -install

現在你的計算機上已經安裝好了MySQL服務了。

2.3.4. 啟動MySQL服務

在黑框里敲入net start mysql,回車。

net start mysql ?// 啟動mysql服務net stop mysql ?// 停止mysql服務

?2.3.5. 修改默認賬戶密碼

在黑框里敲入mysqladmin -u root password 1234,這里的1234就是指默認管理員(即root賬戶)的密碼,可以自行修改成你喜歡的。

mysqladmin -u root password 1234

2.4 登錄MySQL

右鍵開始菜單,選擇命令提示符,打開黑框。 在黑框中輸入,mysql -uroot -p1234,回車,出現下圖且左下角為mysql>,則登錄成功。

mysql -uroot -p1234

到這里你就可以開始你的MySQL之旅了!

退出mysql:

exit
quit

登陸參數:

mysql -u用戶名 -p密碼 -h要連接的mysql服務器的ip地址(默認127.0.0.1) -P端口號(默認3306)

2.5卸載MySQL

如果你想卸載MySQL,也很簡單。

點擊開始菜單,輸入cmd,選擇 "命令提示符",選擇右側的 "以管理員身份運行"。

敲入net stop mysql,回車。

net stop mysql

再敲入mysqld -remove mysql,回車。

mysqld -remove mysql

最后刪除MySQL目錄及相關的環境變量。

至此,MySQL卸載完成!

2.2 數據模型

?

2.3 SQL簡介

?

?

三 數據庫設計-DDL

3.1 數據庫操作

3.2 MySQL客戶端工具

IDEA

?

?

3.2 數據類型?

3.2.1 數值類型

3.2.2 字符串類型

3.2.3 日期時間類型

??

3.2.4 案例

??

create table tb_emp
(id          int auto_increment comment 'ID 主鍵'primary key,username    varchar(20)                  not null comment '用戶名',password    varchar(32) default '123456' not null comment '密碼',name        varchar(10)                  not null comment '姓名',gender      tinyint unsigned             not null comment '性別(1男  2 女)',image       varchar(300)                 null comment '圖形url',job         tinyint unsigned             null comment '職位(1、班主任 2 講師 3 學生主管 4 教研主管)',entrydate   date                         null comment '入職日期',create_time datetime                     not null comment '創建時間',update_time datetime                     not null comment '修改時間'
)comment '員工表';

3.3 表(創建、查詢、修改、刪除)

3.3.1 創建表

?


create table tb_user(id int primary key auto_increment comment 'id,唯一標識',username varchar(20) not null unique comment '用戶名',name varchar(10) not null comment '姓名',age int comment '年齡',gender char(1) default '男' comment '性別'
) comment '用戶表';

?3.3.2 查詢

?

?3.3.3 修改

?

3.3.4 刪除

?

四 數據庫操作-DML

?4.1 添加數據 - insert

4.2 修改數據 - update

4.3 刪除數據 - delete

?

?4.4 總結

五 數據庫操作-DQL

?

5.1 創建db02數據庫,并執行腳本

-- 員工管理(帶約束)
create table tb_emp (id int unsigned primary key auto_increment comment 'ID',username varchar(20) not null unique comment '用戶名',password varchar(32) default '123456' comment '密碼',name varchar(10) not null comment '姓名',gender tinyint unsigned not null comment '性別, 說明: 1 男, 2 女',image varchar(300) comment '圖像',job tinyint unsigned comment '職位, 說明: 1 班主任,2 講師, 3 學工主管, 4 教研主管',entrydate date comment '入職時間',create_time datetime not null comment '創建時間',update_time datetime not null comment '修改時間'
) comment '員工表';-- 準備測試數據
INSERT INTO tb_emp (id, username, password, name, gender, image, job, entrydate, create_time, update_time) VALUES(1, 'jinyong', '123456', '金庸', 1, '1.jpg', 4, '2000-01-01', '2022-10-27 16:35:33', '2022-10-27 16:35:35'),(2, 'zhangwuji', '123456', '張無忌', 1, '2.jpg', 2, '2015-01-01', '2022-10-27 16:35:33', '2022-10-27 16:35:37'),(3, 'yangxiao', '123456', '楊逍', 1, '3.jpg', 2, '2008-05-01', '2022-10-27 16:35:33', '2022-10-27 16:35:39'),(4, 'weiyixiao', '123456', '韋一笑', 1, '4.jpg', 2, '2007-01-01', '2022-10-27 16:35:33', '2022-10-27 16:35:41'),(5, 'changyuchun', '123456', '常遇春', 1, '5.jpg', 2, '2012-12-05', '2022-10-27 16:35:33', '2022-10-27 16:35:43'),(6, 'xiaozhao', '123456', '小昭', 2, '6.jpg', 3, '2013-09-05', '2022-10-27 16:35:33', '2022-10-27 16:35:45'),(7, 'jixiaofu', '123456', '紀曉芙', 2, '7.jpg', 1, '2005-08-01', '2022-10-27 16:35:33', '2022-10-27 16:35:47'),(8, 'zhouzhiruo', '123456', '周芷若', 2, '8.jpg', 1, '2014-11-09', '2022-10-27 16:35:33', '2022-10-27 16:35:49'),(9, 'dingminjun', '123456', '丁敏君', 2, '9.jpg', 1, '2011-03-11', '2022-10-27 16:35:33', '2022-10-27 16:35:51'),(10, 'zhaomin', '123456', '趙敏', 2, '10.jpg', 1, '2013-09-05', '2022-10-27 16:35:33', '2022-10-27 16:35:53'),(11, 'luzhangke', '123456', '鹿杖客', 1, '11.jpg', 2, '2007-02-01', '2022-10-27 16:35:33', '2022-10-27 16:35:55'),(12, 'hebiweng', '123456', '鶴筆翁', 1, '12.jpg', 2, '2008-08-18', '2022-10-27 16:35:33', '2022-10-27 16:35:57'),(13, 'fangdongbai', '123456', '方東白', 1, '13.jpg', 1, '2012-11-01', '2022-10-27 16:35:33', '2022-10-27 16:35:59'),(14, 'zhangsanfeng', '123456', '張三豐', 1, '14.jpg', 2, '2002-08-01', '2022-10-27 16:35:33', '2022-10-27 16:36:01'),(15, 'yulianzhou', '123456', '俞蓮舟', 1, '15.jpg', 2, '2011-05-01', '2022-10-27 16:35:33', '2022-10-27 16:36:03'),(16, 'songyuanqiao', '123456', '宋遠橋', 1, '16.jpg', 2, '2010-01-01', '2022-10-27 16:35:33', '2022-10-27 16:36:05'),(17, 'chenyouliang', '12345678', '陳友諒', 1, '17.jpg', null, '2015-03-21', '2022-10-27 16:35:33', '2022-10-27 16:36:07'),(18, 'zhang1', '123456', '張一', 1, '2.jpg', 2, '2015-01-01', '2022-10-27 16:35:33', '2022-10-27 16:36:09'),(19, 'zhang2', '123456', '張二', 1, '2.jpg', 2, '2012-01-01', '2022-10-27 16:35:33', '2022-10-27 16:36:11'),(20, 'zhang3', '123456', '張三', 1, '2.jpg', 2, '2018-01-01', '2022-10-27 16:35:33', '2022-10-27 16:36:13'),(21, 'zhang4', '123456', '張四', 1, '2.jpg', 2, '2015-01-01', '2022-10-27 16:35:33', '2022-10-27 16:36:15'),(22, 'zhang5', '123456', '張五', 1, '2.jpg', 2, '2016-01-01', '2022-10-27 16:35:33', '2022-10-27 16:36:17'),(23, 'zhang6', '123456', '張六', 1, '2.jpg', 2, '2012-01-01', '2022-10-27 16:35:33', '2022-10-27 16:36:19'),(24, 'zhang7', '123456', '張七', 1, '2.jpg', 2, '2006-01-01', '2022-10-27 16:35:33', '2022-10-27 16:36:21'),(25, 'zhang8', '123456', '張八', 1, '2.jpg', 2, '2002-01-01', '2022-10-27 16:35:33', '2022-10-27 16:36:23'),(26, 'zhang9', '123456', '張九', 1, '2.jpg', 2, '2011-01-01', '2022-10-27 16:35:33', '2022-10-27 16:36:25'),(27, 'zhang10', '123456', '張十', 1, '2.jpg', 2, '2004-01-01', '2022-10-27 16:35:33', '2022-10-27 16:36:27'),(28, 'zhang11', '123456', '張十一', 1, '2.jpg', 2, '2007-01-01', '2022-10-27 16:35:33', '2022-10-27 16:36:29'),(29, 'zhang12', '123456', '張十二', 1, '2.jpg', 2, '2020-01-01', '2022-10-27 16:35:33', '2022-10-27 16:36:31');

?5.2 select語法-基本查詢

--  =================== DQL: 基本查詢 ======================
-- 1. 查詢指定字段 name,entrydate 并返回
select name,entrydate from tb_emp;-- 2. 查詢返回所有字段
select id, username, password, name, gender, image, job, entrydate, create_time, update_time from tb_emp;
select * from tb_emp;-- 3. 查詢所有員工的 name,entrydate, 并起別名(姓名、入職日期)
select name as 姓名,entrydate as 入職日期 from tb_emp;
select name 姓名,entrydate 入職日期 from tb_emp;
select name '姓  名',entrydate 入職日期 from tb_emp;-- 4. 查詢已有的員工關聯了哪幾種職位(不要重復)
select distinct  job from tb_emp;

?5.3 select語法-條件查詢

--  =================== DQL: 條件查詢 ======================
-- 1. 查詢 姓名 為 楊逍 的員工
select * from tb_emp where name='楊逍';-- 2. 查詢 id小于等于5 的員工信息
select * from tb_emp where id <= 5;-- 3. 查詢 沒有分配職位 的員工信息
select * from tb_emp where job is null;-- 4. 查詢 有職位 的員工信息
select * from tb_emp where job is not null;-- 5. 查詢 密碼不等于 '123456' 的員工信息
select * from tb_emp where password != '123456';
select * from tb_emp where password <> '123456';-- 6. 查詢 入職日期 在 '2000-01-01' (包含) 到 '2010-01-01'(包含) 之間的員工信息
select * from tb_emp where entrydate >='2000-01-01' and entrydate <='2100-01-01';
select * from tb_emp where entrydate between '2000-01-01' and '2100-01-01';
-- 7. 查詢 入職時間 在 '2000-01-01' (包含) 到 '2010-01-01'(包含) 之間 且 性別為女 的員工信息
select * from tb_emp where entrydate between '2000-01-01' and '2100-01-01' and gender = 2;-- 8. 查詢 職位是 2 (講師), 3 (學工主管), 4 (教研主管) 的員工信息
select * from tb_emp where job ='2'or job= '3' or job='4';
select * from tb_emp where job in(2, 3, 4);
-- 9. 查詢 姓名 為兩個字的員工信息
select * from tb_emp where name like '__';-- 10. 查詢 姓 '張' 的員工信息
select * from tb_emp where name like '張%';

?5.4?select語法-分組查詢

?

--  =================== DQL: 分組查詢 ======================
-- 聚合函數-- 1. 統計該企業員工數量
-- A 字段
select count(id) from tb_emp;
-- B 常量
select count(1) from tb_emp;-- C *
select count(*) from tb_emp;-- 2. 統計該企業員工 ID 的平均值
select avg(id) from tb_emp;-- 3. 統計該企業最早入職的員工
select min(entrydate) from tb_emp;-- 4. 統計該企業最遲入職的員工
select max(entrydate) from tb_emp;-- 5. 統計該企業員工的 ID 之和
select sum(id) from tb_emp;-- 分組
-- 1. 根據性別分組 , 統計男性和女性員工的數量
select gender,count(*) from tb_emp group by gender;-- 3. 先查詢入職時間在 '2015-01-01' (包含) 以前的員工 , 并對結果根據職位分組 , 獲取員工數量大于等于2的職位
select job,count(*) from tb_emp where entrydate <= '2015-01-01' group by job having count(*) >= 2 ;

5.5?select語法-排序查詢

--  =================== 排序查詢 ======================
-- 1. 根據入職時間, 對員工進行升序排序
select * from tb_emp order by entrydate;
select * from tb_emp order by entrydate asc;-- 2. 根據入職時間, 對員工進行降序排序
select * from tb_emp order by entrydate desc ;-- 3. 根據 入職時間 對公司的員工進行 升序排序 , 入職時間相同 , 再按照 更新時間 進行降序排序
select * from tb_emp order by entrydate,update_time desc ;

?5.6?select語法-分頁查詢

--  =================== 分頁查詢 ======================
-- 1. 從起始索引0開始查詢員工數據, 每頁展示5條記錄
select * from tb_emp limit 0,5;-- 2. 查詢 第1頁 員工數據, 每頁展示5條記錄
select * from tb_emp limit 0,5;-- 3. 查詢 第2頁 員工數據, 每頁展示5條記錄
select * from tb_emp limit 5,5;-- 4. 查詢 第3頁 員工數據, 每頁展示5條記錄
select * from tb_emp limit 10,5;-- 5467 起始索引計算公式 = (頁碼- 1) * 每頁展示記錄數select * from tb_emp limit 10,5;

?5.7 案例1

??

select *
from tb_emp
where name like '張%'and gender = 1and entrydate between '2000-01-01' and '2015-12-31'
order by update_time desc
limit 0, 10;

?5.8 案例2

-- 2.1
select if(gender=1,'男性員工','女性員工') 性別,count(*) from tb_emp group by gender;-- 2-2
select (case job when 1 then '班主任' when 2 then '講師' when 3 then '學生主管'  when 4 then '教研主管' else '未分配職位' end ) as 職位,count(*) from tb_emp group by job;

?5.9 總結

六 多表設計

6.1 一對多

?

?

??

-- 部門管理
create table tb_dept(id int unsigned primary key auto_increment comment '主鍵ID',name varchar(10) not null unique comment '部門名稱',create_time datetime not null comment '創建時間',update_time datetime not null comment '修改時間'
) comment '部門表';-- 員工管理(帶約束)
create table tb_emp (id int unsigned primary key auto_increment comment 'ID',username varchar(20) not null unique comment '用戶名',password varchar(32) default '123456' comment '密碼',name varchar(10) not null comment '姓名',gender tinyint unsigned not null comment '性別, 說明: 1 男, 2 女',image varchar(300) comment '圖像',job tinyint unsigned comment '職位, 說明: 1 班主任,2 講師, 3 學工主管, 4 教研主管',entrydate date comment '入職時間',dept_id int unsigned comment '部門ID',create_time datetime not null comment '創建時間',update_time datetime not null comment '修改時間'
) comment '員工表';insert into tb_dept (id, name, create_time, update_time) values(1,'學工部',now(),now()),(2,'教研部',now(),now()),(3,'咨詢部',now(),now()),(4,'就業部',now(),now()),(5,'人事部',now(),now());INSERT INTO tb_emp(id, username, password, name, gender, image, job, entrydate,dept_id, create_time, update_time) VALUES(1,'jinyong','123456','金庸',1,'1.jpg',4,'2000-01-01',2,now(),now()),(2,'zhangwuji','123456','張無忌',1,'2.jpg',2,'2015-01-01',2,now(),now()),(3,'yangxiao','123456','楊逍',1,'3.jpg',2,'2008-05-01',2,now(),now()),(4,'weiyixiao','123456','韋一笑',1,'4.jpg',2,'2007-01-01',2,now(),now()),(5,'changyuchun','123456','常遇春',1,'5.jpg',2,'2012-12-05',2,now(),now()),(6,'xiaozhao','123456','小昭',2,'6.jpg',3,'2013-09-05',1,now(),now()),(7,'jixiaofu','123456','紀曉芙',2,'7.jpg',1,'2005-08-01',1,now(),now()),(8,'zhouzhiruo','123456','周芷若',2,'8.jpg',1,'2014-11-09',1,now(),now()),(9,'dingminjun','123456','丁敏君',2,'9.jpg',1,'2011-03-11',1,now(),now()),(10,'zhaomin','123456','趙敏',2,'10.jpg',1,'2013-09-05',1,now(),now()),(11,'luzhangke','123456','鹿杖客',1,'11.jpg',1,'2007-02-01',1,now(),now()),(12,'hebiweng','123456','鶴筆翁',1,'12.jpg',1,'2008-08-18',1,now(),now()),(13,'fangdongbai','123456','方東白',1,'13.jpg',2,'2012-11-01',2,now(),now()),(14,'zhangsanfeng','123456','張三豐',1,'14.jpg',2,'2002-08-01',2,now(),now()),(15,'yulianzhou','123456','俞蓮舟',1,'15.jpg',2,'2011-05-01',2,now(),now()),(16,'songyuanqiao','123456','宋遠橋',1,'16.jpg',2,'2010-01-01',2,now(),now()),(17,'chenyouliang','123456','陳友諒',1,'17.jpg',NULL,'2015-03-21',NULL,now(),now());

??外鍵約束

????????

6.2 一對一

?


-- ===========================================一對一=====================================
create table tb_user(id int unsigned  primary key auto_increment comment 'ID',name varchar(10) not null comment '姓名',gender tinyint unsigned not null comment '性別, 1 男  2 女',phone char(11) comment '手機號',degree varchar(10) comment '學歷'
) comment '用戶信息表';insert into tb_user values (1,'白眉鷹王',1,'18812340001','初中'),(2,'青翼蝠王',1,'18812340002','大專'),(3,'金毛獅王',1,'18812340003','初中'),(4,'紫衫龍王',2,'18812340004','碩士');create table tb_user_card(id int unsigned  primary key auto_increment comment 'ID',nationality varchar(10) not null comment '民族',birthday date not null comment '生日',idcard char(18) not null comment '身份證號',issued varchar(20) not null comment '簽發機關',expire_begin date not null comment '有效期限-開始',expire_end date comment '有效期限-結束',user_id int unsigned not null unique comment '用戶ID',constraint fk_user_id foreign key (user_id) references tb_user(id)
) comment '用戶信息表';insert into tb_user_card values (1,'漢','1960-11-06','100000100000100001','朝陽區公安局','2000-06-10',null,1),(2,'漢','1971-11-06','100000100000100002','靜安區公安局','2005-06-10','2025-06-10',2),(3,'漢','1963-11-06','100000100000100003','昌平區公安局','2006-06-10',null,3),(4,'回','1980-11-06','100000100000100004','海淀區公安局','2008-06-10','2028-06-10',4);

6.3 多對多

--  ======================================多對多=============================
create table tb_student(id int auto_increment primary key comment '主鍵ID',name varchar(10) comment '姓名',no varchar(10) comment '學號'
) comment '學生表';
insert into tb_student(name, no) values ('黛綺絲', '2000100101'),('謝遜', '2000100102'),('殷天正', '2000100103'),('韋一笑', '2000100104');create table tb_course(id int auto_increment primary key comment '主鍵ID',name varchar(10) comment '課程名稱'
) comment '課程表';
insert into tb_course (name) values ('Java'), ('PHP'), ('MySQL') , ('Hadoop');create table tb_student_course(id int auto_increment comment '主鍵' primary key,student_id int not null comment '學生ID',course_id  int not null comment '課程ID',constraint fk_courseid foreign key (course_id) references tb_course (id),constraint fk_studentid foreign key (student_id) references tb_student (id)
)comment '學生課程中間表';insert into tb_student_course(student_id, course_id) values (1,1),(1,2),(1,3),(2,2),(2,3),(3,4);

?

?

?6.4 總結

?6.5 綜合案例

-- 瑞吉點餐頁面原型 , 設計表結構
-- 分類表
create table category(id int unsigned primary key auto_increment comment '主鍵ID',name varchar(20) not null unique comment '分類名稱',type tinyint unsigned not null comment '類型 1 菜品分類 2 套餐分類',sort tinyint unsigned not null comment '順序',status tinyint unsigned not null default 0 comment '狀態 0 禁用,1 啟用',create_time datetime not null comment '創建時間',update_time datetime not null comment '更新時間'
) comment '菜品及套餐分類' ;-- 菜品表
create table dish(id int unsigned primary key auto_increment comment '主鍵ID',name varchar(20) not null unique comment '菜品名稱',category_id int unsigned not null comment '菜品分類ID',price decimal(8, 2) not null comment '菜品價格',image varchar(300) not null comment '菜品圖片',description varchar(200) comment '描述信息',status tinyint unsigned not null default 0 comment '狀態, 0 停售 1 起售',create_time datetime not null comment '創建時間',update_time datetime not null comment '更新時間'
) comment '菜品';-- 套餐表
create table setmeal(id int unsigned primary key auto_increment comment '主鍵ID',name varchar(20) not null unique comment '套餐名稱',category_id int unsigned not null comment '分類id',price decimal(8, 2) not null comment '套餐價格',image varchar(300) not null comment '圖片',description varchar(200) comment '描述信息',status tinyint unsigned not null default 0 comment '狀態 0:停用 1:啟用',create_time datetime not null comment '創建時間',update_time datetime not null comment '更新時間'
)comment '套餐' ;-- 套餐菜品關聯表
create table setmeal_dish(id int unsigned primary key auto_increment comment '主鍵ID',setmeal_id int unsigned not null comment '套餐id ',dish_id int unsigned not null comment '菜品id',copies tinyint unsigned not null comment '份數'
)comment '套餐菜品關系';

七 多表查詢

7.1 內連接

?

7.2? 外連接

7.3 子查詢

????????

?

?

?

????????

?

?

7.4 總結

7.5 案例

?

?

?

?

?

?

八 事務

8.1 概念

8.2 操作

?

?

?8.3 四大特性

????????

?8.4 總結?

?

九 索引

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/42664.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/42664.shtml
英文地址,請注明出處:http://en.pswp.cn/news/42664.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

Servlet+JDBC實戰開發書店項目講解第六篇:訂單實現

ServletJDBC實戰開發書店項目講解第六篇&#xff1a;訂單實現 1. 數據庫設計 在訂單實現之前&#xff0c;我們需要對數據庫進行相應的設計。在這個書店項目中&#xff0c;我們可以創建以下兩個表來實現訂單功能&#xff1a; 1.1 訂單表(Order) 訂單ID(order_id)&#xff1a…

vue3 實現簡單瀑布流

一、整理思路 實際場景中&#xff0c;瀑布流一般由 父組件 提供 數據列表&#xff0c;子組件渲染每個圖片都是根據容器進行 絕對定位 &#xff0c;從而定好自己的位置取出 屏幕的寬度&#xff0c;設定 圖片的寬度 固定 為一個值&#xff0c;計算可以鋪 多少列按列數 先鋪上第一…

使用Julia進行核遞歸最小二乘算法(KRLS)的解析與實現

F 標題&#xff1a; 使用Julia進行核遞歸最小二乘算法&#xff08;KRLS&#xff09;的深度解析與實現 第一部分&#xff1a; 核遞歸最小二乘算法 (KRLS) 是一個在線核回歸算法&#xff0c;這種算法的主要特點是能夠一次處理一個樣本&#xff0c;并構建一個訓練點字典&#xf…

5G科技防汛,助力守護一方平安

“立秋雖已至&#xff0c;炎夏尚還在”&#xff0c;受臺風席卷以及季節性影響全國多地正面臨強降水的嚴峻挑戰。“落雨又順秋&#xff0c;綿綿雨不休”&#xff0c;正值“七下八上” 防汛關鍵時期&#xff0c;貴州省水文水資源局已全面進入備戰狀態。 為確保及時響應做好防汛搶…

Vue3 setup新特性簡單應用

去官網學習→組合式 API&#xff1a;setup() | Vue.js 運行示例&#xff1a; 代碼&#xff1a;App.vue <template><div class"home"><img alt"Vue logo" src"../assets/logo.png"><!-- msg 組件傳遞數據 --><Hell…

VBA_MF系列技術資料1-157

MF系列VBA技術資料 為了讓廣大學員在VBA編程中有切實可行的思路及有效的提高自己的編程技巧&#xff0c;我參考大量的資料&#xff0c;并結合自己的經驗總結了這份MF系列VBA技術綜合資料&#xff0c;而且開放源碼&#xff08;MF04除外&#xff09;&#xff0c;其中MF01-04屬于定…

MySQL 面試題

一、數據庫基礎 1、MySQL 有哪些數據庫類型? (1) 整數類型&#xff1a; TINYINT 1 字節 SMALLINT 2 字節 MEDIUMINT 3 字節 INT 4 字節 BIGINT 8 字節 ① 任何整數類型都可以加上 UNSIGNED …

【學會動態規劃】最長湍流子數組(23)

目錄 動態規劃怎么學&#xff1f; 1. 題目解析 2. 算法原理 1. 狀態表示 2. 狀態轉移方程 3. 初始化 4. 填表順序 5. 返回值 3. 代碼編寫 寫在最后&#xff1a; 動態規劃怎么學&#xff1f; 學習一個算法沒有捷徑&#xff0c;更何況是學習動態規劃&#xff0c; 跟我…

vue+elementui 實現文本超出長度顯示省略號,鼠標移上懸浮展示全部內容

一、場景 表單內的輸入框一般為固定寬度&#xff0c;當輸入框內容長度超出輸入框寬度時&#xff0c;需要顯示省略號&#xff0c;并設置鼠標移到輸入框上時懸浮展示全部內容。 <el-tooltipplacement"top-start"effect"light":content"basicData[Or…

在 IDEA 中使用 Git開發 圖文教程

在 IDEA 中使用 Git開發 圖文教程 一、連接遠程倉庫二、IDEA利用Git進行開發操作三、分支操作3.1 新建分支3.2 切換分支3.3 刪除分支3.4 比較分支3.5 合并分支 四、常用快捷鍵 一、連接遠程倉庫 一、打開IDEA&#xff0c;進入目錄&#xff1a;File ->New ->Project from…

Skywalking全鏈路追蹤【學習筆記】

Skywalking全鏈路追蹤的服務搭建&#xff0c;使用docker進行安裝。 搭建服務 搭建【ES】 # 拉取 docker pull docker.elastic.co/elasticsearch/elasticsearch:7.17.10 # 啟動 docker run -p 127.0.0.1:9200:9200 -p 127.0.0.1:9300:9300 -e "discovery.typesingle-nod…

什么是 SPI,和API有什么區別?

面試回答 Java 中區分 API 和 SPI&#xff0c;通俗的講&#xff1a;API 和 SPI 都是相對的概念&#xff0c;他們的差別只在語義上&#xff0c;API 直接被應用開發人員使用&#xff0c;SPI 被框架擴展人員使用。 API Application Programming Interface 大多數情況下&#xff…

opencv 矩陣運算

1.矩陣乘&#xff08;*&#xff09; Mat mat1 Mat::ones(2,3,CV_32FC1);Mat mat2 Mat::ones(3,2,CV_32FC1);Mat mat3 mat1 * mat2; //矩陣乘 結果 2.元素乘法或者除法&#xff08;mul&#xff09; Mat m Mat::ones(2, 3, CV_32FC1);m.at<float>(0, 1) 3;m.at…

瀏覽器控制臺調試實用方法

許多程序員僅知道控制臺的console.log&#xff0c;其實控制臺API還包含一些其他實用方法&#xff0c; 這些方法在前端調試時會很有幫助。 目錄 console.dir 查看對象屬性和方法 輸出DOM元素 console.error console.time和console.timeEnd console.log console.clear 總結…

set NOCOUNT on

SET NOCOUNT ON 是一條 SQL 語句&#xff0c;用于禁止在執行查詢時返回受影響的行數消息。通常&#xff0c;當執行 INSERT、UPDATE、DELETE 等操作時&#xff0c;數據庫會返回一個消息&#xff0c;表示受影響的行數。但在某些情況下&#xff0c;你可能希望禁用這些消息&#xf…

(五)、深度學習框架源碼編譯

1、源碼構建與預構建&#xff1a; 源碼構建&#xff1a; 源碼構建是通過獲取軟件的源代碼&#xff0c;然后在本地編譯生成可執行程序或庫文件的過程。這種方法允許根據特定需求進行配置和優化&#xff0c;但可能需要較長的時間和較大的資源來編譯源代碼。 預構建&#xff1a; 預…

dubbo與zookeeper

ZooKeeper 在 Dubbo 應用中的作用 ZooKeeper 是一個開源的分布式協調服務&#xff0c;它在 Dubbo 中被廣泛使用來實現服務注冊、發現和配置管理等功能。在 Dubbo 架構中&#xff0c;ZooKeeper 扮演了一個重要的角色&#xff0c;可以提供以下功能&#xff1a; ZooKeeper 是一個開…

2023年05月 C/C++(二級)真題解析#中國電子學會#全國青少年軟件編程等級考試

第1題:數字放大 給定一個整數序列以及放大倍數x,將序列中每個整數放大x倍后輸出。 時間限制:1000 內存限制:65536 輸入 包含三行: 第一行為N,表示整數序列的長度(N ≤ 100); 第二行為N個整數(不超過整型范圍),整數之間以一個空格分開; 第三行包含一個整數(不超過整…

【RocketMQ】SpringBoot集成RocketMQ

SpringBoot集成RocketMQ 首先依舊是引入依賴 <dependency><groupId>org.apache.rocketmq</groupId><artifactId>rocketmq-spring-boot-starter</artifactId><version>2.2.2</version> </dependency>然后就可以編寫發送不同類…

Vue2-全局事件總線、消息的訂閱與發布、TodoList的編輯功能、$nextTick、動畫與過渡

&#x1f954;&#xff1a;高度自律即自由 更多Vue知識請點擊——Vue.js VUE2-Day9 全局事件總線1、安裝全局事件總線2、使用事件總線&#xff08;1&#xff09;接收數據&#xff08;2&#xff09;提供數據&#xff08;3&#xff09;組件銷毀前最好解綁 3、TodoList中的孫傳父&…