随笔分类 -  数据库

摘要:1 oracle的数据模式是:用户建在数据库实例上,表建在用户上 不同数据库实例可以建相同的用户; 同一个数据库实例,用户名不能相同; 一个用户可以使用多个表空间; 一个表空间可以被多个用户所使用; 表的权限是和用户绑定的; 表空间不涉及任何权限控制问题; 不同用户可以在表空间上创建同名表,但是此时 阅读全文
posted @ 2024-07-16 16:09 Journey&Flower 阅读(51) 评论(0) 推荐(0)
摘要:-- 查询重复数据 select qr_code,created_at,station_by from t_product_data where flag = 0 and qr_code in( select qr_code from t_product_data t where flag = 0 阅读全文
posted @ 2024-06-07 09:58 Journey&Flower 阅读(10) 评论(0) 推荐(0)
摘要:select substring_index( substring_index(t1.ori_comma_values, ',', t2.split_times), ',', -1) as split_value from (select '13055,28917,33583,42776,43832 阅读全文
posted @ 2024-05-17 15:25 Journey&Flower 阅读(11) 评论(0) 推荐(0)
摘要:1-while循环 create procedure sum1(count int) begin declare sum int default 0; declare i int default 1; while i<=count do set sum=sum+i; set i=i+1; end w 阅读全文
posted @ 2024-04-18 14:59 Journey&Flower 阅读(55) 评论(0) 推荐(0)
摘要:查询分组求和 db.coin_log.aggregate([ { $match: { merchan_code: 111111 ,uid: 170861762319106048 ,category: { $in: [100,200,300] } ,username: { $regex: "real0 阅读全文
posted @ 2024-02-23 20:51 Journey&Flower 阅读(196) 评论(0) 推荐(0)
摘要:mysql语法 insert values on duplicate key update where新增时如果唯一列重复,则更新原始数据(与之重复的数据) create or replace TABLE `t_user` ( `id` int(10) NOT NULL AUTO_INCREMENT COMMENT '主键', `user_code` varchar(32) CHARACTER SE 阅读全文
posted @ 2023-09-23 20:53 Journey&Flower 阅读(93) 评论(0) 推荐(0)
摘要:转载:https://blog.csdn.net/Devin_LiuYM/article/details/59539020 阅读全文
posted @ 2023-05-24 17:10 Journey&Flower 阅读(17) 评论(0) 推荐(0)
摘要:https://blog.csdn.net/redy_hello/article/details/50902098 http://blog.csdn.net/machinecat0898/article/details/7792471 http://blog.csdn.net/lishiyuzuji 阅读全文
posted @ 2023-05-24 17:09 Journey&Flower 阅读(17) 评论(0) 推荐(0)
摘要:正常过滤t1表数据行 SELECT t1.colums FROM t1 LEFT JOIN t2 ON t1.refId = t2.id WHERE t1.isdelete = 0 正常过滤t1表数据行 SELECT t1.colums FROM t1 INNER JOIN t2 ON t1.ref 阅读全文
posted @ 2023-02-09 16:35 Journey&Flower 阅读(11) 评论(0) 推荐(0)
摘要:1.创建自增序列(seq_student) CREATE OR REPLACE SEQUENCE seq_student INCREMENT BY 1 --每次增加1,可以写非0的任何整数 START WITH 1000 -- 从1开始(起始值) NOMAXVALUE -- 设置最大值:设置为 NO 阅读全文
posted @ 2022-12-29 15:11 Journey&Flower 阅读(127) 评论(0) 推荐(0)
摘要:SqlServer 2008R2配置局域网隧道远程连接SQL Server 2008 R2默认是不允许远程连接的,如果想要在本地用SSMS连接远程服务器上的SQL Server 2008,远程连接数据库。需要做三个部分的配置: 1、SQL Server Management Studio Express(简写SSMS) 2、SQL Server 配置管 阅读全文
posted @ 2022-11-04 00:07 Journey&Flower 阅读(857) 评论(0) 推荐(0)
摘要:CASE: 表一 新增字段 AGE, 需要从 表二中 将AGE数据同步到表一中, 或者 单纯同步两张表中的数据 表1:EMPLOYEE(被更新的表 字段 age ) 表2: T_USER 数据来源表 方法一: 使用 exists 只更新表1中 age 为null的数据 UPDATE t_target 阅读全文
posted @ 2022-10-18 16:38 Journey&Flower 阅读(4712) 评论(0) 推荐(0)
摘要:Oracle数据库DBLINK创建/查询/删除1、创建DBLINK create database link to_remoteDB connect to scott identified by tiger using '(DESCRIPTION =(ADDRESS_LIST =(ADDRESS =(PROTOCOL = TCP)(HOST = 阅读全文
posted @ 2022-10-18 14:20 Journey&Flower 阅读(616) 评论(0) 推荐(0)
摘要:1、Oracle时间戳(毫秒)转为Date SELECT 1656991607001 / (1000 * 60 * 60 * 24) + TO_DATE('1970-01-01 08:00:00', 'yyyy-MM-dd hh24:mi:ss') CDATE FROM dual; 2、以1970年 阅读全文
posted @ 2022-07-21 21:20 Journey&Flower 阅读(19784) 评论(0) 推荐(0)
摘要:1、执行注意事项 DECLARE v_taskCode VARCHAR2(100) := 'aaaaaa'; v_workno VARCHAR2(100) := 'bbbbbb'; v_procode VARCHAR2(100) := 'cccccc'; returnMsg VARCHAR2(100 阅读全文
posted @ 2022-07-10 21:56 Journey&Flower 阅读(1029) 评论(0) 推荐(0)
摘要:oracle中的select语句可以用START WITH...CONNECT BY PRIOR子句实现递归查询,connect by 是结构化查询中用到的,其基本语法如下: select * from tablename start with cond1 connect by cond2 wher 阅读全文
posted @ 2022-05-20 10:44 Journey&Flower 阅读(16) 评论(0) 推荐(0)
摘要:Oracle不支持IF not Exists()解决办法 方案一: INSERT into table1 (column1,column2) select '123','456' from dual where not exists (select roleid from table1 where 阅读全文
posted @ 2022-05-19 13:43 Journey&Flower 阅读(477) 评论(0) 推荐(0)
摘要:时间 2014-01-18 00:14:15 IT社区推荐资讯 原文 http://itindex.net/detail/47663-oracle-更新-删除 主题 Oracle数据库 有时候我们在操作ORACLE数据库的时候,可能由于SQL写错了导致把数据update错了,或者delete删除掉了 阅读全文
posted @ 2022-05-16 21:26 Journey&Flower 阅读(620) 评论(0) 推荐(0)
摘要:依次执行以下语句修复 ALTER DATABASE [PLM_DB] SET SINGLE_USER; --快速修复 DBCC CHECKDB ('PLM_DB', REPAIR_FAST); --重建索引并修复 DBCC CHECKDB ('PLM_DB', REPAIR_REBUILD); -- 阅读全文
posted @ 2022-04-30 22:26 Journey&Flower 阅读(200) 评论(0) 推荐(0)
摘要:依次执行以下语句进行修复 ALTER DATABASE CAPP_DB SET EMERGENCY; ALTER DATABASE CAPP_DB SET SINGLE_USER; DBCC CheckDB (CAPP_DB , REPAIR_ALLOW_DATA_LOSS); ALTER DATA 阅读全文
posted @ 2022-04-30 22:20 Journey&Flower 阅读(43) 评论(0) 推荐(0)