oracle不得不知道的sql
一、oracle 查询语句
1.translate
select translate('abc你好cdefgdc','abcdefg','1234567')from dual;
select translate('abc你好cdefgdc','abcdefg','')from dual;--如果替换字符整个为空字符 ,则直接返回null
select translate('abc你好cdefgdc','abcdefg','122')from dual;
select translate('12334567','1233' ,'abcd') from dual;--相同字符对应多个字符,按第一个来替换
2.处理空值 nvl
null和任何数据做任何操作都是null。这点很重要
select nvl(nvl(nvl(null,0),0),0)from dual;
select nvl(1,0)from dual;
select coalesce(null,null,9,0)from dual;
3.decode 即if-then-else 逻辑
select decode(59,70,'C',80,'B',90,'A',60,'D','E')from dual;
select decode(59,null,0)from dual;
在update 语句后携带 where 条件,否则就会报错。
set sql_safe_updates=1; --mysql中 表示开启该参数
4.拼接列:||
select '姓名:' || 'wx' from dual;
select concat('姓名','性别')from dual;
5.在where 字句中引用取别名的列
在where 字句中引用取别名的列 ,引用别名的时候要嵌套一层,因为这个别名是在select之后才有效的
select *from (
select trunc(sysdate) as t1, trunc(sysdate-1) as t2 from dual) where t1 > trunc(syadate);
6.在select语句中使用条件逻辑:case when then
select 档次,count(*) as 人数 from (
select (case when score <=60 then '0-60'
when score <=70 then '60-70'
when score <=90 then '70-90'
when score <=100 then '90-100' else '0' end )as 档次
from tbl_stu u) group by 档次 order by 1;
或者
select nvl(sum(case when score <=60 then 1 else 0 end),0),
nvl(sum(case when score <=70 and score > 60 then 1 else 0 end),0),
nvl(sum(case when score <=90 and score > 70 then 1 else 0 end),0),
nvl(sum(case when score <=100 and score > 90 then 1 else 0 end),0)
from tbl_stu ;
6.限制返回的行数:rownum
select *from tbl_stu where rownum < 3;
7.视图 view
视图总是显示最新的数据!每当用户查询视图时,数据库引擎通过使用视图的 SQL 语句重建数据。
视图隐藏了底层的表结构,简化了数据访问操作,用户不需要知道底层表的结构和表之间的关系
create or replace view v_1 as
select *from tbl_stu r where r.id=1;
create or replace view v_2 as
select *from tbl_stu u where u.score='55';
create or replace view v_t4 as
select id,c1,c2,c3 from t4_1;
通过view 新增数据,不能再使用关键字default
insert into v_t4 values(5,'输入',default,'c4');
select *from v_t4;
8.复制表的定义及数据(不包含默认值,索引,约束)
8.1 复制表结构及数据
create table tbl_stu_copy as select *from tbl_stu;
select *from tbl_stu_copy;
先复制表,再复制数据
8.2 只复制表结构
create table tbl_stu_copy2 as select *from tbl_stu where 1=2;
create table tbl_stu_copy3 like tbl_stu;
select *from tbl_stu_copy2;
8.3只复制数据
insert into tbl_stu_copy2 select *from tbl_stu; --表结构一样
insert into table_name_new(column1,column2...) select column1,column2... from table_name_old;--表结构不一样
insert into tbl_s(id,name,sex) select id,name,'女' from tbl_stu;--表结构不一样
8.4 select into from 和 insert into select from
select into from ;--要求目标表不存在,因为在插入时会自动创建。
select id,name,descs,score,object into tbl_stu23 from tbl_stu;-- 一般在PL/SQL程序块(block)中使用。 否则会报 ORA-00905: 缺失关键字。T-SQL中该句正常
insert into select from ;--要求目标表存在
insert into tbl_stu1 select *from tbl_stu where id=1;
9.with check option 限制数据的录入
alter table tbl_stu add constraint CONSTRAINT_score check(score>33);
insert into tbl_stu values (22,'ee','hahah1',35,'english');
insert into (select id,name,descs,score,object from tbl_stu
where score <=100 with check option)
values (23,'test','with check option',100,'biology');
10.多表插入语句
create table tbl_stu5 as select id,name,descs from tbl_stu where 1=2;
create table tbl_stu4 as select id,name,score from tbl_stu where 1=2;
10.1无条件 insert
insert all
into tbl_stu4(id,name,score) values (id,name,score)
into tbl_stu5(id,name,descs)values(id,name,descs)
select id,name,descs,score from tbl_stu u where u.id <10;
select *from tbl_stu5;
10.2有条件 insert all
delete tbl_stu4;
delete tbl_stu5;
insert all
when score =55 then
into tbl_stu4(id,name,score) values (id,name,score)
when descs ='阳光开朗,目标是年薪百万' then
into tbl_stu5(id,name,descs)values(id,name,descs)
select id,name,descs,score from tbl_stu u ;
10.3 insert first 第一个条件匹配了,第二个就不会再去匹配
insert first
when score =55 then
into tbl_stu4(id,name,score) values (id,name,score)
when descs ='阳光开朗,目标是年薪百万' then
into tbl_stu5(id,name,descs)values(id,name,descs)
select id,name,descs,score from tbl_stu u ;
10.4转置insert
create table t6 (d varchar2(40),des varchar(60));
create table t7 as
select '熊样,谨慎不加' as d1,
'猫杨,温馨听话' as d2,
'狗样,神气活现' as d3,
'鸟样,向往明天' as d4
from dual;
select *from t6;
select *from t7;
insert all
into t6(d,des)values('周一',d1)
into t6(d,des)values('周二',d2)
into t6(d,des)values('周三',d3)
into t6(d,des)values('周四',d4)
select d1,d2,d3,d4 from t7;
11 删除名称重复的数据
create table dupes (id integer,name varchar2(30));
insert into dupes values (1,'wx');
insert into dupes values (2,'wx');
insert into dupes values (3,'wx1');
insert into dupes values (5,'wx1');
insert into dupes values (6,'wx1');
insert into dupes values (7,'hahha');
11.1方法一:通过name相同,id同 删除
select *from dupes;
delete dupes;
delete from dupes a where exists (
select null from dupes b where b.name=a.name and b.id>a.id );
11.2方法二 rowid
delete from dupes a where exists (
select null from dupes b where b.name=a.name and b.rowid>a.rowid );
通过分析函数 根据name生成序列号
select rowid as rid,name,
ROW_NUMBER () OVER (PARTITION BY name
ORDER BY id) as seq
from dupes
order by 2,3;
删除seq>1 的就好,这个方法也可以去重
delete from dupes where
rowid in(select rid from(
select rowid as rid,name,
ROW_NUMBER () OVER (PARTITION BY name
ORDER BY id) as seq
from dupes )
WHERE SEQ>1);
12.生成连续数值
select level as rn from dual connect by level<=3;
13.遍历字符串
create or replace view v5 as
select '天天向上' as 汉字,'TTXS' as 首拼 from dual;
select *from v5;
select 汉字,首拼,level from v5 connect by level<=length(汉字);
SELECT 汉字,首拼,level ,
substr(汉字,level,1)as 汉字拆分,
substr(首拼,level,1)as 首拼拆分,
'subsrt('''|| 汉字||''',' || level || ',1)' as fun from v5
connect by level<=length (汉字);
13.计算字符在字符串中出现的次数
create or replace view v6 as
select 'clark,king,miller' as str from dual;
select regexp_count(str,',')+1 as count from v6;
14.lag,lead分析函数 lag是前一个记录,lead是后一个记录
select name,descs,score ,object ,id,
lag(id) over(order by id )lag_id,
lead(id) over(order by id)lead_id
from tbl_stu;
15.周的计算
with x as (select date'2019-01-01'as d from dual)
select to_char(d,'dy')as wd1,to_char(d,'day')as wd2,to_char(d,'d')as wd3 from x;
alter session set nls_language=american;
16.取某个月的第一个周二 with :序号
with x as (select date'2019-01-01'as d from dual)
select to_char(d,'dy')as wd1,to_char(d,'day')as wd2,to_char(d,'d')as wd3 from x;
alter session set nls_language=american;
17.union(去重了), union all ,连接多个表的select,必须保证查询的字段及字段类型一致
select name from tbl_stu
union
select name from tbl_stu1;
18.sql 约束
--not null :不允许有空值
alter table tbl_stu modify name varchar2(20) not null;
--unique :每行有唯一的值。一张表可以有多个uniques
--primary key:每行有唯一的值且不能为空。一张表只能有一个primary key
--foreign key:与其他表有对应的数据
--check: 保证列中的值符合指定的条件
alter table tbl_stu add constraint chk_id check(id <77);
insert into tbl_stu (id,name,descs,score)values(101,'wx','www',77);
alter table tbl_stu drop constraint chk_id;--删除约束
alter table tbl_stu modify firstdate date default sysdate;--增加单个列
alter table tbl_stu add (lastdate date,sex varchar2(10));--增加多个列
select * from tbl_stu;
--default: 给默认值
19.oracle auto-increment.通过创建序列实现
create SEQUENCE squ_stu
minvalue 11
start with 11
increment by 1
cache 100;
insert into tbl_stu(id,name,sex,descs,score)values(squ_stu.nextval,'22','2','22',55);
select squ_stu.nextval from tbl_stu;--取出了100个索引
20.sql 基本函数
20.1 avg
select avg(score),sum(score),count(*),sum(score)/count(1)from tbl_stu;
20.2 count
select count(1),count(case when score=55 then 1 end),count(case when score>55 then 1 end)
from tbl_stu;
20.3 rownum
select *from tbl_stu where rownum<=1;
SELECT *FROM(select * from tbl_stu order by id desc) where rownum<=1;
20.4 max(),min(),sum()
select name,max(score),min(score),sum(score) from tbl_stu group by name having sum(score)>55;
20.5 upper().lower()
select upper(name) ,lower(name),descs from tbl_stu;
20.6 substr() 函数用于从文本字段中提取字符
select substr(descs,2,8)from tbl_stu;
20.7 length()函数
select LENGTH(descs)from tbl_stu;
20.8 round
INSERT INTO tbl_stu (id,name,score)values(squ_stu.nextval,'hahh',33.444);
select round(score,2)from tbl_stu where name='hahh' ;
select sysdate,to_char(sysdate,'yyyy-MM-dd') from dual;
20.9 分层查询
select level ,id,sudeptid,empno from tbl_department t start with SUDEPTID is null connect by (prior id)= t.SUDEPTID;
21 抽取重复记录
with t_test as (
select 1 id ,'张三1' name, '男' sex from dual union all
select 2 id ,'张三2' name, '男' sex from dual union all
select 3 id ,'张三3' name, '女' sex from dual union all
select 4 id ,'张三4' name, '女' sex from dual union all
select 5 id ,'张三5' name, '男' sex from dual
)
select max(id) id , t.sex --,t.name
from t_test t
group by t.sex
having count(*) > 1;with t_test as (
select 1 id ,'张三1' name, '男' sex from dual union all
select 2 id ,'张三2' name, '男' sex from dual union all
select 3 id ,'张三3' name, '女' sex from dual union all
select 4 id ,'张三4' name, '女' sex from dual union all
select 5 id ,'张三5' name, '男' sex from dual
)
select *
from t_test t1
where t1.id in (select max(t2.id) id
from t_test t2
group by t2.sex
having count(*) > 1);with t_test as (
select 1 id ,'张三1' name, '男' sex from dual union all
select 2 id ,'张三2' name, '男' sex from dual union all
select 3 id ,'张三3' name, '女' sex from dual union all
select 4 id ,'张三4' name, '女' sex from dual union all
select 5 id ,'张三5' name, '男' sex from dual
)
select *
from (select a.*, row_number() over(partition by sex order by id desc) rn
from t_test a)
where rn = 1;
22 删除全表数据
Delete from tbl_operation_cmdb_bak;
truncate table tbl_operation_cmdb_bak;
declare
v_num number(8);
v_rowid rowid;
v_row_count NUMBER DEFAULT 500; -- 默认提交行数
TYPE typ_cursor IS REF CURSOR;
cur_select_table typ_cursor;
BEGIN
OPEN cur_select_table FOR
SELECT s.rowid
FROM tbl_operation_cmdb_bak s;
LOOP
FETCH cur_select_table
INTO v_rowid;
EXIT WHEN cur_select_table%NOTFOUND;
DELETE FROM tbl_operation_cmdb_bak
WHERE ROWID = v_rowid;
IF MOD(v_num, v_row_count) = 0 THEN
COMMIT;
END IF;
v_num := v_num + 1;
END LOOP;
COMMIT;
CLOSE cur_select_table;
end;declare
v_row_count NUMBER DEFAULT 500; -- 默认提交行数
TYPE v_rowid_type IS TABLE OF ROWID INDEX BY BINARY_INTEGER;
v_rowid v_rowid_type;
TYPE typ_cursor IS REF CURSOR;
cur_select_table typ_cursor;
BEGIN
OPEN cur_select_table FOR
SELECT s.rowid
FROM tbl_operation_cmdb_bak s;
LOOP
FETCH cur_select_table BULK COLLECT
INTO v_rowid LIMIT v_row_count;
FORALL i IN 1 .. v_rowid.COUNT()
DELETE FROM tbl_operation_cmdb_bak
WHERE ROWID = v_rowid(i);
COMMIT;
EXIT WHEN cur_select_table%NOTFOUND;
END LOOP;
COMMIT;
CLOSE cur_select_table;
END;
23 更新多列
update emp
set sal =
(select max(sal)
from emp),
comm =
(select max(comm)
from emp)
where empno = 7369;update emp
set (sal, comm) =
(select max(sal), max(comm)
from emp)
where empno = 7369;update emp
set comm = 1000
where job in ('ANALYST', 'SALESMAN')
and mgr = 7698;
update emp
set sal = 1100
where job in ('MANAGER', 'CLERK')
and mgr = 7698;update emp
set comm =
(case job
when 'ANALYST' then
1000
when 'SALESMAN' then
1000
else
comm
end),
sal =
(case job
when 'MANAGER' then
1100
when 'CLERK' then
1100
else
sal
end)
where job in ('ANALYST', 'SALESMAN', 'MANAGER', 'CLERK')
and mgr = 7698;
24 显示表中第5-10条记录-注意排序
with t_test as (
select 1 id ,'张三1' name, '男' sex from dual union all
select 2 id ,'张三2' name, '男' sex from dual union all
select 3 id ,'张三3' name, '女' sex from dual union all
select 4 id ,'张三4' name, '女' sex from dual union all
select 5 id ,'张三5' name, '男' sex from dual union all
select 6 id ,'张三4' name, '女' sex from dual union all
select 7 id ,'张三5' name, '男' sex from dual union all
select 8 id ,'张三4' name, '女' sex from dual union all
select 9 id ,'张三5' name, '男' sex from dual union all
select 10 id ,'张三4' name, '女' sex from dual union all
select 11 id ,'张三5' name, '男' sex from dual union all
select 12 id ,'张三4' name, '女' sex from dual union all
select 13 id ,'张三5' name, '男' sex from dual union all
select 14 id ,'张三4' name, '女' sex from dual union all
select 15 id ,'张三5' name, '男' sex from dual
)
select *
from (select rownum r, a.*
from t_test a
order by a.id)
where r > 4
and r < 11;with t_test as (
select 1 id ,'张三1' name, '男' sex from dual union all
select 2 id ,'张三2' name, '男' sex from dual union all
select 3 id ,'张三3' name, '女' sex from dual union all
select 4 id ,'张三4' name, '女' sex from dual union all
select 5 id ,'张三5' name, '男' sex from dual union all
select 6 id ,'张三4' name, '女' sex from dual union all
select 7 id ,'张三5' name, '男' sex from dual union all
select 8 id ,'张三4' name, '女' sex from dual union all
select 9 id ,'张三5' name, '男' sex from dual union all
select 10 id ,'张三4' name, '女' sex from dual union all
select 11 id ,'张三5' name, '男' sex from dual union all
select 12 id ,'张三4' name, '女' sex from dual union all
select 13 id ,'张三5' name, '男' sex from dual union all
select 14 id ,'张三4' name, '女' sex from dual union all
select 15 id ,'张三5' name, '男' sex from dual
)
select *
from (select rownum r, a.*
from t_test a
where rownum < 11
order by id)
where r > 4;
with t_test as (
select 1 id ,'张三1' name, '男' sex from dual union all
select 2 id ,'张三2' name, '男' sex from dual union all
select 3 id ,'张三3' name, '女' sex from dual union all
select 4 id ,'张三4' name, '女' sex from dual union all
select 5 id ,'张三5' name, '男' sex from dual union all
select 6 id ,'张三4' name, '女' sex from dual union all
select 7 id ,'张三5' name, '男' sex from dual union all
select 8 id ,'张三4' name, '女' sex from dual union all
select 9 id ,'张三5' name, '男' sex from dual union all
select 10 id ,'张三4' name, '女' sex from dual union all
select 11 id ,'张三5' name, '男' sex from dual union all
select 12 id ,'张三4' name, '女' sex from dual union all
select 13 id ,'张三5' name, '男' sex from dual union all
select 14 id ,'张三4' name, '女' sex from dual union all
select 15 id ,'张三5' name, '男' sex from dual
)
select *
from (select /*+ first_rows */
rownum r, a.*
from t_test a
where rownum < 11
order by id)
where r > 4;
with t_test as (
select 1 id ,'张三1' name, '男' sex from dual union all
select 2 id ,'张三2' name, '男' sex from dual union all
select 3 id ,'张三3' name, '女' sex from dual union all
select 4 id ,'张三4' name, '女' sex from dual union all
select 5 id ,'张三5' name, '男' sex from dual union all
select 6 id ,'张三4' name, '女' sex from dual union all
select 7 id ,'张三5' name, '男' sex from dual union all
select 8 id ,'张三4' name, '女' sex from dual union all
select 9 id ,'张三5' name, '男' sex from dual union all
select 10 id ,'张三4' name, '女' sex from dual union all
select 11 id ,'张三5' name, '男' sex from dual union all
select 12 id ,'张三4' name, '女' sex from dual union all
select 13 id ,'张三5' name, '男' sex from dual union all
select 14 id ,'张三4' name, '女' sex from dual union all
select 15 id ,'张三5' name, '男' sex from dual
)
select *
from (select rownum rn, a.*
from (select *
from t_test aa
order by id) a
where rownum <11) aa
where rn > 4;
25 递归
with TBL_DIV as (
select '节点1' name, 1 c, null p from dual union all
select '节点2', 2 c, 1 p from dual union all
select '节点3', 3 c, 2 p from dual union all
select '节点4', 4 c, 3 p from dual union allselect '节点5', 5 c, 2 p from dual union all
select '节点6', 6 c, 3 p from dual)
SELECT name,c, p, LEVEL,--层级
SYS_CONNECT_BY_PATH(name, '|'),--路径
CONNECT_BY_ISLEAF,--是否叶子节点
CONNECT_BY_ROOT(name) --根
FROM TBL_DIV A
START WITH c =1 --3
CONNECT BY PRIOR c = p;
26 存在则更新,否则插入
merge into T_POLICY_PERSON aa
using (select v_POLICY_NUMBER c1, v_ORGANIZATION_CODE c2 from dual) bb
on(aa.POLICY_NUMBER = bb.c1)
when matched then
update set aa.ORGANIZATION_CODE = bb.c2, aa.MODIFY_DATE = sysdate
when not matched then
insert(id, POLICY_NUMBER, ORGANIZATION_CODE, MODIFY_DATE) values(LOWER(SYS_GUID()), bb.c1, bb.c2, sysdate);
27 行转列
with temp as
(select 'China' nation, 'Guangzhou' city
from dual
union all
select 'China' nation, 'Shanghai' city
from dual
union all
select 'China' nation, 'Beijing' city
from dual
union all
select 'USA' nation, 'New York' city
from dual
union all
select 'USA' nation, 'Bostom' city
from dual
union all
select 'Japan' nation, 'Tokyo' city
from dual)
select nation, listagg(city, ',') within GROUP(order by city)
from temp
group by nation;
28 列转行
with tt as
(select 1 INDEXDEF, 'a,b,c,d,e' GRADECODE
from dual)
SELECT INDEXDEF, REGEXP_SUBSTR(GRADECODE, '[^,]+', 1, LEVEL, 'i') GRADECODE
FROM tt
CONNECT BY LEVEL <= LENGTH(GRADECODE) - LENGTH(REGEXP_REPLACE(GRADECODE, ',', '')) + 1;
二、Oracle建表
1.建user表
create table tbl_user
(
id NUMBER primary key not null,
name NVARCHAR2 (30)not null,
content NVARCHAR2(2000),
createtime DATE,
lastmodifytime DATE
);
comment on column tbl_user.id is '唯一标识';
comment on column tbl_user.name is '姓名';
comment on column tbl_user.content is '调用内容';
comment on column tbl_user.createtime is '创建时间';
comment on column tbl_user.lastmodifytime is '最后修改时间';
comment on table tbl_user is '用户表';
commit;
2.创建自增的序列号
create sequence user_sequence
minvalue 1
maxvalue 99999999 --最大的值
start with 1
increment by 1
NOCYCLE -- 一直累加,不循环
nocache; --不建缓冲区select user_sequence.nextval from tbl_user;
select *from user_sequence ;--查询所有已建立的序列
3.存储过程
create or replace procedure p
(v_a in number,v_b number, v_ret out number,v_temp in out number)
is
begin
if(v_a >v_b)then
v_ret :=v_b;
else
v_ret:=v_b;
end if;
v_temp:=v_temp+1;
end;
4. 创建article表
create table tbl_article(
id number primary key not null,
title Nvarchar2 (300),
content Nvarchar2(2000),
createtime DATE,
lastmodifytime DATE
);
comment on tbl_article.id is '唯一标示';
comment on tbl_article.title is '标题';
comment on tbl_article.content is '内容';
comment on tbl_article.createtime is '插入时间';
comment on tbl_article.lastmodifytime is '修改时间';
commit;
--创建序列
create sequence article_sequence
minvalue 1
maxvalue 99999999
start with 1
increment by 1
nocycle --一直累加不循环
nocache; --没有缓存
--insert 语句
insert into tbl_article values(article_sequence.nextval,'java','java是面向对象的语言。',sysdate,'');
--动态插入 批量语句
begin
for i in 3 .. 10
loop
insert into tbl_article values ( article_sequence.nextval, 'java','java是跨平台语言,一次编译多次运行。因为有不同操作系统的JVM,帮我们隔开了底层代码逻辑。',sysdate,null );
end loop;
commit;
end;
相关文章:

oracle不得不知道的sql
一、oracle 查询语句 1.translate select translate(abc你好cdefgdc,abcdefg,1234567)from dual; select translate(abc你好cdefgdc,abcdefg,)from dual;--如果替换字符整个为空字符 ,则直接返回null select translate(abc你好cdefgdc,abcdefg,122)from dual; sel…...

算法-卡尔曼滤波之卡尔曼滤波的第二个方程:预测方程(状态外推方程)
在上一节中,使用了静态模型,我们推导出了卡尔曼滤波的状态更新方程,但是在实际情况下,系统都是动态,预测阶段,前后时刻的状态是改变的,此时我们引入预测方程,也叫状态外推方程&#…...

刘邦的创业团队是沛县人,朱元璋的则是凤阳;要创业,一个县人才就够了
当人们回顾刘邦和朱元璋的创业经历时,总是会感慨他们起于微末,都创下了偌大王朝,成就无上荣誉。 尤其是我们查阅史书时,发现这二人的崛起班底都是各自的家乡人,例如刘邦的班底就是沛县人,朱元璋的班底是凤…...

【Unity之FairyGUI】你了解FGUI吗,跨平台多功能高效UI插件
👨💻个人主页:元宇宙-秩沅 👨💻 hallo 欢迎 点赞👍 收藏⭐ 留言📝 加关注✅! 👨💻 本文由 秩沅 原创 👨💻 收录于专栏:就业…...

基于51单片机的自动浇花器电路
一、系统概述 自动浇水灌溉系统设计方案,以AT89C51单片机为控制核心,采用模块化的设计方法。 组成部分为:5V供电模块、土壤湿度传感器模块、ADC0832模数转换模块、水泵控制模块、按键输入模块、LCD显示模块和声光报警模块,结构如…...

2024中国(重庆)商旅文化川渝美食暨消费品博览会8月举办
2024中国(重庆)商旅文化川渝美食暨消费品博览会8月举办 邀请函 主办单位: 中国航空学会 重庆市南岸区人民政府 招商执行单位: 重庆港华展览有限公司 展会背景: 2024中国航空科普大会暨第八届全国青少年无人机大赛在重庆举办ÿ…...

MacOS docker 安装与配置
orbstack 安装 官网: https://orbstack.dev 下载链接:Download OrbStack Fast, light, simple Docker Desktop alternative 选择是Apple M系列处理器, 或 Intel系列处理器 到这里就安装好了Orbstack软件,下面开始配置docker 下…...

【嵌入式大赛应用赛道】机械手臂
电机 进步电机:它的转动是以确定的步数进行的,只要计算好脉冲数量和频率,就可以准确预测和控制电机的转动角度、速度以及停止的位置 伺服电机:将输入的电信号(如电压或电流指令)转换成轴上的精确旋转运动…...

MES系统主要包括那些功能?
一开始接触MES系统,对MES细条的功能不清楚,这样很正常,因为MES系统相对于其他系统来讲,功能有多又复杂! 作为曾参与200企业MES系统架构的资深从业人员,我给大家选出了一款优秀模板——简道云MES系统,给大家…...

git 合并commit
操作步骤 合并commit cd xxx/ git checkout a8c0efegfwgtw # 最新commit git reset rhgertheryhg --soft # 最初的commit git status git checkout -b test1 git commit -m "test1" git branch git push origin test1 git tag test1_v0.0.1 git push origin test1_…...

【ARMv8/v9 系统寄存器 5 -- CPU ID 判断寄存器 MPIDR_EL1 使用详细介绍】
文章目录 寄存器名称: MPIDR_EL1寄存器结构:主要功能和用途亲和级别(Affinity Levels)简介CORE ID 获取函数 在ARMv8-A架构中, MPIDR_EL1寄存器是一个非常重要的系统寄存器,它提供了关于处理器在其物理和逻辑配置中的位置的信息。…...

软件工程课程设计之酒店管理系统的设计与实现
这是一个简化的酒店管理系统的需求分析文档、系统设计文档、测试文档的结构概述,以及部分实现阶段的代码示例。详细设计阶段的数据字典、ER图、模块分类图将以文字描述形式给出,而完整的代码未完全实现。这里只做软件工程部分的设计需求说明哈࿵…...

函数递归练习
目录 1.分析下面选择题 2.实现求第n个斐波那契数 3.编写一个函数实现n的k次方,使用递归实现。 4.写一个递归函数DigitSum(n),输入一个非负整数,返回组成它的数字之和 5.递归方式实现打印一个整数的每一位 6.实现求n的阶乘 1.分析下面选择…...

公有云Linux模拟TCP三次挥手与四次握手(Wireshark抓包验证版)
目录 写在前面环境准备实验步骤1. 安装nc工具2. 使用nc打开一个连接2.1 公有云-安全组放行对应端口(可选) 3. 打开Wireshark抓包工具4. 新开终端,进行连接5. 查看抓包文件,验证TCP三次握手与四次挥手TCP三次握手数据传输TCP四次挥…...

【Day3:JAVA运算符、方法的介绍】
目录 1、运算符1.1 赋值运算符1.2 比较运算符1.3 逻辑运算符1.3.1 逻辑运算符概述1.3.2 逻辑运算符分类1.3.3 短路的逻辑运算符 1.4 三元运算符1.5 运算符优先级 2、方法2.1 方法介绍2.2 方法的定义和调用格式2.2.1 方法的调用2.2.2 带参数方法的调用2.2.3 带返回值方法的调用2…...

Chrome查看User Agent的实战教程
大家好,我是爱编程的喵喵。双985硕士毕业,现担任全栈工程师一职,热衷于将数据思维应用到工作与生活中。从事机器学习以及相关的前后端开发工作。曾在阿里云、科大讯飞、CCF等比赛获得多次Top名次。现为CSDN博客专家、人工智能领域优质创作者。喜欢通过博客创作的方式对所学的…...

Linux 第三十四章
🐶博主主页:ᰔᩚ. 一怀明月ꦿ ❤️🔥专栏系列:线性代数,C初学者入门训练,题解C,C的使用文章,「初学」C,linux 🔥座右铭:“不要等到什么都没有了…...

国际化日期(inti)
我们可以使用国际化API自动的格式化数字或者日期,并且格式化日期或数字的时候是按照各个国家的习惯来进行格式化的,非常的简单; const now new Date(); labelDate.textContent new Intl.DateTimeFormat(zh-CN).format(now);比如说这是按照…...

【论文阅读笔记】jTrans(ISSTA 22)
个人博客地址 [ISSTA 22] jTrans(个人阅读笔记) 论文:《jTrans: Jump-Aware Transformer for Binary Code Similarity》 仓库:https://github.com/vul337/jTrans 提出的问题 二进制代码相似性检测(BCSD࿰…...

单位个人如何向期刊投稿发表文章?
在单位担任信息宣传员一职以来,我深感肩上的责任重大。每月的对外信息宣传投稿不仅是工作的核心,更是衡量我们部门成效的重要指标。起初,我满腔热血,以为只要勤勉努力,将精心撰写的稿件投至各大报社、报纸期刊的官方邮箱,就能顺利登上版面,赢得读者的青睐。然而,现实远比理想骨…...

Redis数据结构-RedisObject
1.7 Redis数据结构-RedisObject Redis中的任意数据类型的键和值都会被封装为一个RedisObject,也叫做Redis对象,源码如下: 1、什么是redisObject: 从Redis的使用者的角度来看,⼀个Redis节点包含多个databaseÿ…...

Vue 中使用 el-date-picker 限制只能选择当天、当天之前或当天之后日期的方法详解
网上很多都是不完整的,我这里发布一个完整的 - 8.64e7 表示可选择当天时间(注:小于当前时间,- 8.64e7 则是禁用日期不包含当前日,若大于当前日期, 8.64e7 则是禁用日期包含当前日) time.getTi…...

系列介绍:《创意代码:Processing艺术编程之旅》
系列介绍:《创意代码:Processing艺术编程之旅》 标题创意: “代码绘梦:Processing艺术编程入门”“数字画布:用Processing创造视觉奇迹”“编程美学:Processing艺术创作指南”“创意编程:Proc…...

深度学习设计模式之抽象工厂模式
文章目录 前言一、介绍二、详细分析1.核心组成2.实现步骤3.代码示例4.优缺点优点缺点 5.使用场景 总结 前言 本文主要学习抽象工厂模式,抽象工厂模式创建的是对象家族,比如:苹果是一个产品,但是他不单单只生产手机,还…...

K8s是什么?
url address K8s是一个开源的容器编排平台,可以自动化,在部署,管理和扩展容器化应用过程中涉及的许多手动操作。 Kubernetes最初是由Google工程师作为Borg项目开发和设计的,后于2015年捐赠给云原生计算基金会(CNCF&a…...

【网站项目】SpringBoot796水产养殖系统
🙊作者简介:拥有多年开发工作经验,分享技术代码帮助学生学习,独立完成自己的项目或者毕业设计。 代码可以私聊博主获取。🌹赠送计算机毕业设计600个选题excel文件,帮助大学选题。赠送开题报告模板ÿ…...

Vue详细介绍
Vue.js(通常简称为Vue)是一个用于构建用户界面的渐进式JavaScript框架。它由尤雨溪(Evan You)创建,并于2014年首次发布。Vue的设计目的是易于上手,同时也能够强大到驱动复杂的单页应用(SPA&…...

声纹识别的对抗与防御
随着机器学习理论和方法的发展, 出现了用于模仿特定说话人语音的深度伪造、针对语音识别和声纹识别的对抗样本, 它们都为破坏语音载体的可信性和安全性提供了具体手段, 进而对各自应用场景的信息安全构成了挑战。 深度伪造是利用生成式对抗网络等方法, 通过构建特定的模型, 产生…...

C++ QT设计模式总结
Ciallo~(∠・ω< )⌒★,这里是 Eureka,欢迎来看我的设计模式总结,有问题随时可以告诉我~ 面向对象的设计模式: 以下总结了面向对象的设计模式, QT 的源码在哪里体现了这些模式,以及如何在 …...

洛谷 P3203:弹飞绵羊 ← 分块算法(单点更新、单点查询)
【题目来源】https://www.acwing.com/problem/content/2168/https://www.luogu.com.cn/problem/P3203【题目描述】 某天,Lostmonkey 发明了一种超级弹力装置,为了在他的绵羊朋友面前显摆,他邀请小绵羊一起玩个游戏。 游戏一开始,L…...