Hey,
I have a hard time figuring out if OrientDB fits our enterprise needs. But I really enjoy the DB.
The problem is I am always thinking, that I'm doing it the wrong way.
We are analyzing data coming from external vendors and we have to find the needles in the heystack.
Concrete example:
- I have 2 Tables (customer and account)
- these 2 tables have private keys and foreign keys
- 1 customer -> many accounts / many accounts -> 1 customer
- every account has a balance
- every customer has a specific age
These 2 tables come from a RDBMS-like thing (IDs as connections)
I imported the 2 tables in Java using "ODatabaseDocumentTx" ending up with 2 classes (account and customer).
After that I ran a bunch of SQL statements to create Links between them (LINK from account to customer and LINKLIST from customer to account).
What I want to get now:
- all customers where age < 18 that have
- any account where the balance < 0
And from these customers I want to
- display the balance of all accounts summed up
- display the number of accounts
- display the first account number
- also I want to display the name, the ID and what not
My Question is now:
- is it better to use the graph DB (edges instead of links)?
- how can I get from RDBMS SQL to Orient
Example SQL-Query was (I stripped out and translated a few things):
Select customer.ID, customer.Name
'Age : ' || cast(customer.age as char(3)) as Info_001,
CASE WHEN count(account.accountNr) = 1 THEN 'Balance : ' ELSE 'Balance (all accounts) : ' END || cast(sum(account.balance) as char(16)) as Info_002,
CASE WHEN count(account.accountNr) = 1 THEN 'AccountNr : ' ELSE 'first accountNr : ' END || cast(min(account.accountNr) as char(10)) as Info_003,
CASE WHEN count(account.accountNr) > 1 THEN 'Count of further Accounts : ' || cast((count(account.KtoNr) - 1) as char(3)) ELSE '' END as Info_004
from account, customer,
where account.customerID = customer.ID
and account.balance < 0
and customer.age < 18
group by customer.ID, customer.Name
having abs(sum(account.balance)) > abs(0)
This gives me the correct customers matching my criteria.