rdbms

Best Way to Store/Access a Directed Graph

試著忘記壹切 提交于 2019-12-31 09:04:09
问题 I have around 3500 flood control facilities that I would like to represent as a network to determine flow paths (essentially a directed graph). I'm currently using SqlServer and a CTE to recursively examine all the nodes and their upstream components and this works as long as the upstream path doesn't fork alot. However, some queries take exponentially longer than others even when they are not much farther physically down the path (i.e. two or three segments "downstream") because of the added

Microsoft SQL Server to Oracle Data Migration (Conversion) (Other RDBMS ok, too)

女生的网名这么多〃 提交于 2019-12-30 11:56:10
问题 Can you please give some tips or guidelines, best practices for MicroSoft SQL server to Oracle Data Migration? IMHO, it is something that comes best with experience. So I would like to benefit from your experience. Please share any insights that you have into design, modeling, testing or tuning for a data migration project. I would really appreciate if you share your experience even if it is not between these two RDBMSs. 回答1: Oracle offers a free IDE, SQL Developer, which includes a Migration

How to insert multiple rows in the same table-Oracle 10g

若如初见. 提交于 2019-12-30 08:47:08
问题 I created a table in Oracle SQL : create table t1 ( empno number(6) PRIMARY KEY, empname varchar(30), hiredate date, basic number(8), deptno number(4) ); And now I am inserting values into the table using a single query : insert into t1 values((131309,'HP','20-FEB-04',2000000,1235) (131310,'HT','20-APR-14',120020,1234)); But this shows error: insert into t1 values((131309,'HP','20-FEB-04',2000000,1235), * ERROR at line 1: ORA-00907: missing right parenthesis How do I correct this? 回答1: An

PostgreSQL IN operator with subquery poor performance

一世执手 提交于 2019-12-29 16:08:50
问题 Why is the "IN" operator so slow when used with subquery? select * from view1 where id in (1,2,3,4,5,6,7,8,9,10) order by somedata; executes in 9ms. select * from view1 where id in (select ext_id from aggregate_table order by somedata limit 10) order by somedata; executes in 25000ms and seems to use sequential scan on the view ( view1 ) instead of index scan on primary keys returned by subquery as in does in first query. The subquery select ext_id from aggregate_table order by somedata limit

What's the PostgreSQL equivalent of MSSQL's CONTEXT_INFO?

江枫思渺然 提交于 2019-12-29 08:55:34
问题 In relation to my other question "What’s the best way to audit log DELETEs?". What's the PostgreSQL equivalent of CONTEXT_INFO? [EDIT] I want to log deletes using trigger, but since i'm not using the database user as my app's logical user, I cannot log the CURRENT_USER from the trigger code as the user who deleted the record. But for INSERT and UPDATE it is possible to log the record changes from trigger since you can just add a user field in the record, say inserted_by and last_updated_by,

Reasonable Export of Relational to Non-Relational Data

Deadly 提交于 2019-12-29 08:25:08
问题 We have different products that rely on relational databases for various reasons, basically the transactional nature of the operations (atomicity, consistency, etc.). This is not going to change any time soon. Given this scenario, are there any possible justifications to export the data to a NoSQL solution? Maybe Datawarehousing, Analytics, etc. Any comments are welcome. 回答1: "Data" is just a vague generality without a data structure. "Relational" means the data structure is relations/tables

Difference between Relational Algebra and Relational calculus

血红的双手。 提交于 2019-12-29 01:37:15
问题 What is the exact difference between relational algebra and relational calculus. At most of the reference, it will be Relational algebra is procedural and calculus is non procedural . So, what is these stands for. However, we can solve all the problems using relational algebra. Then why we would use relational calculus. Except definition, Explanation with example is much appreciated. 回答1: TL;DR: Queries calling RA (relational algebra) operators & queries of the two relational calculi (RCs)

Difference between Relational Algebra and Relational calculus

旧巷老猫 提交于 2019-12-29 01:35:53
问题 What is the exact difference between relational algebra and relational calculus. At most of the reference, it will be Relational algebra is procedural and calculus is non procedural . So, what is these stands for. However, we can solve all the problems using relational algebra. Then why we would use relational calculus. Except definition, Explanation with example is much appreciated. 回答1: TL;DR: Queries calling RA (relational algebra) operators & queries of the two relational calculi (RCs)

How to best represent an attribute that appears in both master and detail records?

匆匆过客 提交于 2019-12-25 18:41:40
问题 I have a simple master-detail relation in which both entities share an attribute (which happens to be a timestamp, and is not part of the key.) The detail records are ranked (by some other attribute) from top to bottom. The business rule is: (a) If there are detail records, apply the timestamp of the top one to the master; (b) otherwise, the master must have a timestamp regardless; and (c) (rarely) permit the master to have a timestamp that differs from the that of the top detail records. The

How to store a row's multiple column's sum on that same table's same row's another column? [duplicate]

一曲冷凌霜 提交于 2019-12-25 18:03:49
问题 This question already has answers here : How can I write a user defined function in MySQL so that when I delete a row from one table, that particular row from another table also gets deleted? (3 answers) Closed last year . CREATE TABLE `student` ( `student_id` int(5) NOT NULL AUTO_INCREMENT, `student_first_name` varchar(30) not null, `student_lase_name` varchar(30) not null, `student_roll_no` int(5) not null, `student_class` int(2) not null, PRIMARY KEY (`student_id`) ); CREATE TABLE `result