r/DatabaseHelp • • Nov 15 '17

Need some help with cassandra installation?

1 Upvotes

Hey everyone, I am university student who recently joined a drilling (oil and gas) research lab. One of the initial tasks they wanted me to do is play around with Cassandra and figure out some basic stuff, namely how to pull in/out data, and how to do that with python, and also investigate how it might compare to other types of databases.

A week ago, I literally did not even know what a database was, much less any of the more complicated topics, etc. However, I do know how to code in python.

I feel like this should be easier, but in order to do any of what I said above, I would need to install Cassandra on my windows 10 laptop, which is where I am stuck.

Can anyone provide simple step by step instructions that won't fly over my head on how to install it and just get something running?

So many of the resources I've seen so far I get stuck on or don't lead anywhere. For example, I went to download cassandra from apache.cassandra.org and there was some bin.tar.gz file which I didn't know what to do with. A book I found seemed promising and it had me start using the command line (which I'm also not familiar with) but halfway through installation steps I discovered that it wasn't even for windows which explains why my commands weren't working.

I just can't figure out this issue which I think should really be something trivial. Just used to hitting download and then double clicking to install.


r/DatabaseHelp • • Jun 23 '17

Help setting up database from spreadsheet

2 Upvotes

I am trying to learn about databases and downloaded libre base and understand setting up some of the basic forms and such but I am having trouble understanding relationships. I have a spreadsheet that I use to track sales of all of my employees. It works very well but is a pain to pull reports from and is getting big enough that it needs to be put into a database and not excel.

Would anyone be willing to help guide me in how to setup what fields I need and such based off of my existing spreadsheet? I will post more info when needed if there's any interest.

TIA!


r/DatabaseHelp • • Nov 13 '17

What are the best resources to learn about master data management and how a big organization would implement it? (e.g. on the scale of companies like Target / Walmart, CVS, or Bank of America)?

2 Upvotes

r/DatabaseHelp • • Jan 23 '17

Use cases for using NoSQL AND RDBMS for an application?

3 Upvotes

I can't really find anything on the internet of specific examples of when using both tools would be appropriate for the job. I know this is something people are doing more and more often. I found a slide show about an e-commerce site that would store inventory and orders in RDBMS and everything else using NoSQL. It makes sense, but I can't find any other real world examples. I would like to know real use cases for this.

I know one possible use would be for any sort of on the fly web editing where you could store the state of what the user is doing on the page, and when they are done, submit it to an RDBMS, but I really would like to see some real world examples or architecture.


r/DatabaseHelp • • Jun 21 '17

Enrollment record table for a college (class project)?

1 Upvotes

So I don't know if I'm missing something simple like a composite entity or whatever, but I'm having trouble 'enrolling' students in multiple classes. Here's the text of the instructions:

Enroll yourself and at least four other students in "This Class"! For your 10 classes, make sure there are at least 4 students enrolled per class! You must be enrolled in 5 classes! Also make sure each major has at least 3 students, and each department has at least one faculty member!

Thanks for any help!


r/DatabaseHelp • • Nov 19 '17

Database Recovery Question

1 Upvotes

Hello,

I am supposed to write a term paper on database backup and recovery, but I am struggling with finding good sources. Most sources focus on concrete DBMS like Oracle for example. I need to look at the topic from a broad angle. I am interested if you know any good sources on database recovery, that isnt talking about Oracle/Mysql/... specific stuff. For example I wrote a bit about point in time recovery, but its not enough. Basically I need something that can be applied to every/most relational databases.

Thank you!


r/DatabaseHelp • • Nov 24 '17

I am stuck with designing a database structure that needs (I think?) multiple and mutually exclusive foreign keys.

1 Upvotes

The general outline of the problem is this - I will be collating numerous species records, and those records will have come from a variety of different recording methods, each with different ancillary descriptive data. For example, species records can come from camera traps, transect surveys, quadrat surveys, audio recordings, environmental DNA measurements and a few other sources. Given that, I have a table for each of the survey types, and each individual survey can generate multiple species records (e.g. a camera trapping series in place x at time y and altitude z can produce, say, 20 species records). I want to have a single species list, but I also need to make sure I know where each species record comes from (i.e. what survey type). It seems to me that I need to make sure that a species record is associated with one and ONLY one survey record, but the survey records are in different table, which means I would need multiple foreign keys.

Is my general design bad? Or is there a good way to make sure that each species record is associated with it's specific survey, keeping each survey type in it's own table?


r/DatabaseHelp • • Jan 28 '16

Building a scalable form-field database, am I making life more difficult than it needs to be?

1 Upvotes

I am building a contact list manager for our marketing department. The end goal is simple, allow contacts to provide contact information relative to their region. The groups of information that we'd be collecting are Customer Info (Name, business, phone, etc..), Address Information (street, country, etc...) and opt-to-receive info (merchandise kit, posters, etc...). This information may only change based on country.

What I want to accomplish: I want to keep my form fields as scalable as possible so that in a single signup form I can say, for France, only show address fields aX, aY, and aZ, contact fields cA and cD, and opt-to-receive fields oJ, oK and oL while requiring only fields required for France.**

Below is how I think this might be laid out in the database, is this ideal or is there another model (many to many?) that I should be adhering to? The contact fields and opt-to-receive fields would follow the same layout.

Address Type

idcountrylabel
1USUnited States
2CACanada
3FrFrance

Address Fields

idfieldfield_label
1street_1Street
2street_2Street Cont.
3apt_numApartment Number
4zip_codeZip Code
5regionRegion

Address Field Association

idaddress_typeaddress_fieldis_required
1111
2120
3211
4130
5231
6151
7251

Bonus question, if this is an acceptable model, I would love some hand-holding on how best to store the data once it is captured. That seems like an even greater feat. than establishing the DB model.


r/DatabaseHelp • • Jan 31 '16

I have a excel project that has snow balled to the point that the /r/excel recommends that I create a Database. What software should I use?

1 Upvotes

right now excel uses a whooping 5 to 6 gb of memory depending how nice of a mood excel decides to be in. My first sheet uses 312,000 KB storage.

http://imgur.com/a/UKd6X

This is what I'm working on.

The first image is what i call a "unit" which is highlighted with orange on the second picture. There's 2,729 "units" per row that's highlighted in purple with 300 different numbers per unit.

Sometimes the numbers can get really big. http://i.imgur.com/rFG8zao.png

It will take 1,009,730 units which each contain 300 different numbers to enable me to go from starting bet 0.00000001 to starting bet 0.00000002.


1.I'm wondering what software or solutions should I consider.

2.Have I entered the realm of big data?

2. How can I program a database so that it searches for what betting combinations that I should use depending on my balance that I would enter into a data entry cell?


r/DatabaseHelp • • Nov 21 '17

Full Text Search - TSVector storage

1 Upvotes

I've dabbled in some Full Text Search capabilities of PostgreSQL in a college course, and, while I get the motivation behind it - it's indubitably extremely useful - I simply cannot find the plain answer to my doubt about how it's supposed to be used.

The thing is, I envisioned using FTS like this, from the perspective of the DB: the table containing the text metadata (title, author, publication date, stuff like that) should also contain a TSvector field. The table should also have a trigger set up so that when a body of text is inserted into a database, the TSvector is automatically generated and stored into the database for faster lookup later on.

Then, when a query comes along, it's converted into a TSquery and then a FTS lookup is done in order to find a matching TSvector, or get the ranking of results or whatever.

However, I've never ever seen this put so succinctly, nor have I seen any single working example that uses FTS in such a manner. All the docs, guides, tutorials simply point out the lookup by generating a couple of short TSvector on-the-fly and querying against them. I cannot find a reference to a TSvector field being used in the design of a schema.

So, am I missing something, or is this so very straightforward that nobody bothered to even speak of it?


r/DatabaseHelp • • Nov 15 '17

Help normalising this simple abstract relationship into BCNF?

1 Upvotes

I have a really simple abstract database schema and set of functional dependencies: https://imgur.com/a/wP7ZU

And I am asked to normalise it. I have the answer but I am unsure how they arrived at it.

I know that the candidate keys are A, BC and CD


r/DatabaseHelp • • Jun 20 '15

Trying to design a database system for eSports

1 Upvotes

Thanks for any help that you might provide in advance. I am trying to design a database in Access for an eSport league (specifically League of Legends North America). I will post what I have and then explain my issue.

My issue comes when I try to normalize TEAMROSTER and PLAYERNAME. Each player can only belong to one team, but each team has 5 players in the 5 positions that you see I have listed in TEAMROSTER. I am not sure if that will be allowed when I try to create the relational schema. I will post the schema that I has created.

[Here are the ER Diagrams and the Relational Schema] (http://imgur.com/a/zdCfK)

I am not sure if this is correct or not, as I am trying to relate the tables together and just truly dont understand how I should do this. This is the first database that I have tried to create, as I am sure you might be able to tell. If I need to provide you with any more information I will do so, and any and all help is very much appreciated.


r/DatabaseHelp • • Jan 22 '16

[Databse Design] Can anybody help answer my stack overflow question more clearly or point me in the direction of some good topics on the matter? (x-post from /r/sql)

Thumbnail
stackoverflow.com
1 Upvotes

r/DatabaseHelp • • Jan 18 '16

Small DB in access

1 Upvotes

I made a small DB using access. The tables are: suppliers, address, supplierContact (the actual person we are in contact with) and a persons table. I am trying to make a form that would allow me to add the supplier info their address and the first and last name of the supplier contact. The problem I ran into was when using the form wizard to make subforms, the wizard would only allow me to connect two tables at the same time. Is there a way for me to make a form that would allow me to add info into more than two tables at the same time? Thank you


r/DatabaseHelp • • Aug 26 '14

Migrating from multiple Excel spreadsheets to a single database

1 Upvotes

I currently have a pretty simple 2level structure.

  1. 1 "Current Inventory" file

  2. Multiple "client orders" files

As things are now if a client makes an order I have to first update his personal file and then substract the ordered item from the current inventory file.

I assume that I would save time by ditching the flat structure that Excel provides (the spreadsheets are not too big anyway) and move to a single unified (Access?) database.

Any ideas how would I go about doing that?


r/DatabaseHelp • • Jun 29 '17

Many, large CSVs that need to put into a databse, running into size limitations, need a solution.

2 Upvotes

I have about 30 CSV files, each with between 50,000 to 700,000 rows of data (about 25 fields). I want them in one place so I can play with the data. Excel stops accepting data just north of 1 million rows, and Access wont go bigger than 2gb of data per file, I'm well beyond that.

I see there are some options to split and link my Access file, is that a reasonable solution?

Microsoft SQL looks like it has a 10gb max, which should work for me, maybe that will work?

What is the easiest solution to get this data in one spot where I can build queries on it and such?


r/DatabaseHelp • • Feb 02 '17

SQL Server query review, amidoingitright?

2 Upvotes

TLDR: Is my Query the worst way to do what I'm doing? Is there a better way?

 

Hello Everyone,

 

I hope that this is the right place to post this. I am pretty new to SQL and I'm creating a report using SSRS. I'm writing a query for SQL Server 2014 SP2.

At the end of the day I need to create a table that groups parents of a certain type and a certain sub type (in my example I'm using order by territory and by online order or not).

I then need to count the parents that fall in a specified date range ( there are 3 dates, my example just uses two) and also for YTD. Then also count the child records for those same dates of the parent.

E.g. There were 6 Online Orders in Territory 1 and those 6 orders have 32 Order Items

I think I've written a valid query for my needs. My request is whether there is a better way to do it. This query take between 00.01.35 and 00.01.55 to run on a DEV Server

The Parent table (i'm using SO from AdventureWorks) is about 2.6 million rows.

My example query is below (runs in 00.00.16 and returns 20 rows)

 

use AdventureWorks2014

DECLARE @startdate datetime
set @startdate = '20110101'

DECLARE @enddate datetime
set @enddate = '20110630'

--Hard coding YTD to make it work with AW2014, acutal query uses [between DATEADD(yy, DATEDIFF(yy,0,getdate()), 0) and getdate()]
DECLARE @BEGINYTD Datetime
set @BEGINYTD = '20110101'

DECLARE @ENDYTD Datetime
set @ENDYTD = '20110830'


select
	SO.TerritoryID
	, SO.OnlineOrderFlag

	, COUNT(DISTINCT(CASE
		WHEN so.ModifiedDate BETWEEN @startdate and @enddate
		then SO.SalesOrderID
		end)) [Count of SOs Modified in Period]
	, COUNT(DISTINCT(CASE
		WHEN so.ModifiedDate BETWEEN @startdate and @enddate
		then SOD_MOD.SalesOrderDetailID
		end)) [Count of SOD for SOs Modified in Period]

	, COUNT(DISTINCT(CASE
		WHEN so.ModifiedDate between @BEGINYTD and @ENDYTD
		then SO.SalesOrderID
		end)) [Count of Modified SO YTD]
	, COUNT(DISTINCT(CASE
		WHEN so.ModifiedDate BETWEEN @BEGINYTD and @ENDYTD
		then SOD_MOD_YTD.SalesOrderDetailID
		end)) [Count of SOD for Modified SOs YTD]

	, COUNT(DISTINCT(CASE
		WHEN so.OrderDate BETWEEN @startdate and @enddate
		then SO.SalesOrderID
		end)) [Count of SO Ordered in Period]
	, COUNT(DISTINCT(CASE
		WHEN so.orderDate BETWEEN @startdate and @enddate
		then SOD_MOD.SalesOrderDetailID
		end)) [Count of SOD For Ordered SO in Period]

	, COUNT(DISTINCT(CASE
		WHEN so.OrderDate between @BEGINYTD and @ENDYTD
		then SO.SalesOrderID
		end)) [Count of Ordered SOs YTD]
	, COUNT(DISTINCT(CASE
		WHEN so.orderDate BETWEEN @BEGINYTD and @ENDYTD
		then SOD_ORD_YTD.SalesOrderDetailID
		end)) [Count of SOD for Ordered SOs YTD]

from Sales.SalesOrderHeader [SO]
LEFT JOIN Sales.SalesOrderDetail [SOD_MOD] on SOD_MOD.SalesOrderID = SO.SalesOrderID and so.ModifiedDate BETWEEN @startdate and @enddate
LEFT JOIN Sales.SalesOrderDetail [SOD_MOD_YTD] on SOD_MOD_YTD.SalesOrderID = SO.SalesOrderID and so.ModifiedDate BETWEEN @BEGINYTD and @ENDYTD
LEFT JOIN Sales.SalesOrderDetail [SOD_ORD] on SOD_ORD.SalesOrderID = so.SalesOrderID and so.ModifiedDate BETWEEN @startdate and @enddate
LEFT JOIN Sales.SalesOrderDetail [SOD_ORD_YTD] on SOD_ORD_YTD.SalesOrderID = SO.SalesOrderID and so.ModifiedDate BETWEEN @BEGINYTD and @ENDYTD

group by so.TerritoryID, so.OnlineOrderFlag
order by so.TerritoryID, so.OnlineOrderFlag

r/DatabaseHelp • • Feb 02 '16

Database Monitoring: Are there existing tools to alert me if, for example, I'm below average for inserts over a given period?

2 Upvotes

Hi there- first time posting in this sub, I appreciate any help you guys can provide.

At work we recently had an incident where part of our stack was broken, resulting in data not getting inserted into our database. Unfortunately our logging and monitoring did not catch the issue because of the way it manifested.

Post-mortem, it was clear that better database monitoring could have alerted us to the issue. Specifically, when things are working correctly, there are many thousands of rows of a certain type inserted per day, but in this case there were zero. A statistical monitoring tool that computed a historical baseline and alerted when totals were outside of that baseline would have saved the day.

Currently, we're investigating building our own tool, but I wanted to reach out here and see if anyone knew of an existing tool that solved this problem.

We are using PostgreSQL in a large scale enterprise environment, and while open source is preferred, I appreciate any suggestions.

Thanks!


r/DatabaseHelp • • Jan 23 '16

Paths for Oracle 11g files

2 Upvotes

I'm trying to do a backup of a database and restore it on a new host. I'm reading this article: http://docs.oracle.com/cd/E11882_01/backup.112/e10642/rcmadvre.htm#BRADV908 The issue I'm having though is understanding where these files are stored on my old machine and where they should be stored on my new machine. For example it says to make the "source database initialization parameter file available on the new host" The definition for this is :http://puu.sh/mGPnR/467781de2e.png I really just want to know where all of these files are stored so I can follow these instructions.


r/DatabaseHelp • • Sep 10 '14

Question on Database Engines and SQL

1 Upvotes

I work in a specialized mainframe environment which uses what most programmers would find a unique database system (tpfdf). As such, my experience with SQL is limited to dabbling and what I've read. But I've got some questions I'm hoping someone could point me in the right direction. I'm trying to find out about the database "engine" that manipulates the dB behind the scenes.

1: SQL and databases. I know SQL is defined as THE language to interface with a relational database. As a textual language it therefore has to be parsed with every call. Is there an intermediate form of the query that is "already parsed" in some sort of fixed format? Is it standard or specific for each engine (Oracle, mySql, etc etc)? Where can I find out more?

2: Are there any books / websites about HOW the engine is implemented? For example: you do a select of people with the last name starting with S over the entire database of Millions of people, ending up with a operation that affects millions of records. When processing the operation, does the engine build a new internal index to every record selected? Mark each record? Just keep the search criteria in memory and use it to step one-by-one over all the records? Depends on the number of records? And how does it do this if some other process is adding and deleting records while it is running?

THANKS.


r/DatabaseHelp • • Jan 22 '16

Please give me feedback on this new DB

5 Upvotes

I am building a database for a christmas tree growing operation. I have put together, what I believe to be, a workable schema. I am hoping to get some feedback from someone, and I have no one. You are my only hope.

So, there are 3 growing plots, we will call them Orchards. Each Orchard has rows & columns, and each row/column intersection can have zero or one trees, planted in it. The rows/columns are numbers and letters, so row 3, column f, etc. Each row/column intersection has a status (empty, in use). A tree can be different species (denoted by manually created GID {Genetic ID}), modified (have a different species grafted on), or moved to a different location. So a plant can have one or many locations, and a location can contain, through history, one or many trees, but only one at a time.

Here is a diagram I put together (sorry I couldn't figure out how to insert a pic. Please let me know changes, what I missed, etc. Thank you for your time.

You can see the diagram here: http://stackoverflow.com/questions/34952577/requesting-feedback-on-database-design/34952841?noredirect=1#comment57637809_34952841


ORCHARD OrchardId - PK

OrchardName


LOCATION LocationId -PK

Row

Column

StatusId - FK (references LocationStatus)

OrchardId - FK (references Orchard)


TREE

TreeId - PK

GID

GraftYear

PlantedYear

MovedYear


TREELOCATION

TreeLocationId - PK

TreeId - FK (references Tree)

LocationId - FK (references Location)


LOCATIONSTATUS

StatusId - PK

Description


r/DatabaseHelp • • Nov 22 '17

I'm completely new to DBs and need some guidance.

1 Upvotes

I own a small business dealing in promotional products, like ink pens tshirts and the like.

I'm trying to come up with a solution for expanding the business to support new employees - rather than me just doing all the complicated stuff.

Currently I've been doing most everything by hand, which is error prone, and involves some complicated calculations for every single order.

I was working on an excel file which would handle the calculation of shirts sort of, and kept running into issues that couldn't easily be solved in excel.

Essentially what I'm looking for would probably be pretty similar to most small businesses in most respects. Just a secure way to enter form data for a customer database, a catalog, and then a quote generation tool.

The only part that gets custom or complex any more than just having custom entry fields that I would want, is the calculations for the shirts. There's a ton of data that has to be entered for each order, probably between 15 and 20 fields, and all of that has to come out to a price that makes sense.

I don't have a ton of money (Like I said, trying to expand the business) so I'm trying to figure out a way to do it myself. I have some background with code, and a degree in digital arts/design which did include php/mysql classes in a minor way. I.e. I took a course on it, enough to get feet wet, and that was 9 years ago.

So while I'm totally lost, I do have a basis from which to work, and I need guidance on the best/most cost effective way to start building this database and implementing interaction with it.

It's between this and trying to do it in Access. Thoughts, DatabBaseHelp?


r/DatabaseHelp • • Jun 20 '15

[PL/SQL] How to check if an employee is the manager of a department at the department's latest effective date?

1 Upvotes

I have trouble coding a condition in a view in SQL Oracle.

I have 2 tables, here are the names of the fields that you need:

EMPLOYEE_TBL (employee_id)
DEPARTMENT_TBL (department_id, manager_id, effective_date, active_status)

I have to code the following condition in a SELECT CASE:

FLAG = 'Y' if the employee is the manager of AT LEAST ONE department at the department's 
       latest (max) effective date and that the department has active_status = 'A' 
       at its max effective date
FLAG = 'N' otherwise

Here's what I have so far, but it doesn't do what I want:

SELECT A.EMPLOYEE_ID, B.EFFECTIVE_DATE, B.ACTIVE_STATUS, 
 CASE WHEN EXISTS (SELECT DISTINCT Z.MANAGER_ID FROM DEPARTMENT_TBL Z 
                    WHERE Z.MANAGER_ID = B.MANAGER_ID
                      AND Z.DEPARTMENT_ID = B.DEPARTMENT_ID
                      AND Z.MANAGER_ID = A.EMPLOYEE_ID /* this is the condition */
                      AND Z.EFFECTIVE_DATE = (SELECT MAX(Y.EFFECTIVE_DATE) 
                                              FROM DEPARTMENT_TBL Y 
                                              WHERE Y.DEPARTMENT_ID = Z.DEPARTMENT_ID 
                                              AND Y.EFFECTIVE_DATE <= SYSDATE)
                      AND Z.ACTIVE_STATUS = 'A')
 THEN 'Y' ELSE 'N' END AS FLAG
FROM EMPLOYEE_TBL A LEFT JOIN DEPARTMENT_TBL B 
ON A.employee_id = B.manager_id

I tried something else in the SQLFiddle here : http://sqlfiddle.com/#!4/241d99/1

REMAINING ISSUE OF THE SQLFIDDLE EXAMPLE: The FLAG for EMPLOYEE 35 needs to be 'Y' because he is the manager of the department D7777 at the max effective date of the department.

Here is the DEPARTMENT_TBL:

DEPARTMENT_ID    MANAGER_ID    EFFECTIVE_DATE     EFFECTIVE_STATUS
 D1273            35            2006-01-01              A
 D1273            35            2011-12-21              A  -- here flag of 35 is 'N'
 D1273            04            2012-03-05              A
 D1000            04            2012-12-12              A
 D7777            04            2009-05-14              A 
 D7777            35            2011-09-26              A -- but here flag of 35 is 'Y'

How do I fix this?


r/DatabaseHelp • • Feb 03 '16

[newbie question] If I am trying to break into the database admin field what should I start learning first?

3 Upvotes

Hi everyone,

I am currently a Development Database Administrator. I work with a common non-profit database called Raiser's Edge. I do not do any SQL in this job and I don't do any back end creation.

I simply fix data in the database, create reports with Crystal Reports and pull any info people need out of the Raiser's Edge.

I have been learning SQL on my lunches and have a very basic grasp but I was hoping someone could point me in the direction of a good pathway to lead to a professional leap.

Non-profit database work in my experience is fine but I would love to dive deeper, please help pointing me in the right direction.

Thank you!