database

How to normalize a database where different user groups have different kinds of profiles?

My application database has a Groups table that separates users into logical roles and defines access levels (admin, owner, salesperson, customer service, etc.) Groups has many Users. The Users table contains login details such as username and password. Now I wish to add user profiles to my database. The trouble I'm having (probably ...

If don't own proprietary database engine, what is best way to convert database to mysql?

I work for a very small company. I was recently faced with the question of whether there is a good way to convert a proprietary database to a MySQL database without owning the proprietary database engine e.g. if one is given a large oracle database file (or choose your favorite proprietary database engine format), but doesn't have a lice...

Get information from various sources

Hi. I'm developing an app that has to get some information from various sources (APIs and RSS) and display it to the user in near real-time. What's the best way to get it: 1.Have a cron job to update them all accounts every 12h, and when a user is requesting one, update that account, save it to the DB and show it to the user? 2.Have a...

How do I connect to SqlLite db file from c#?

Hey all... I am trying to connect to a sqllite db from with a c# application. I have never worked with SQLLite before. var connectionString = @"data source='C:\TestData\StressData.s3db'"; connection = new SQLiteConnection(connectionString); connection.Open(); When i attempt to open the connection I get the fol...

Implementing Transparent Persistence

Transparent persistence allows you to use regular objects instead of a database. The objects are automatically read from and written to disk. Examples of such systems are Gemstone and Rucksack (for common lisp). Simplified version of what they do: if you access foo.bar and bar is not in memory, it gets loaded from disk. If you do foo.ba...

Tables as relations in ER diagrams

Assume I have the following tables (**bold** - primary key, *italics* - foreign key): patient(**patient_id**, name) disease(**disease_id**, name) patient_disease(**p_d_id**, *patient_id*, *disease,_id* ) I want to draw the ER diagram for this. My idea is to make two entities, one for patient and one for disease, then make a n-to-n rel...

How do we greatly optimize our MySQL database (or replace it) when using joins?

Hi there, This is the first time I'm approaching an extremely high-volume situation. This is an ad server based on MySQL. However, the query that is used incorporates a lot of JOINs and is generally just slow. (This is Rails ActiveRecord, btw) sel = Ads.find(:all, :select => '*', :joins => "JOIN campaigns ON ads.campaign_id = campai...

SQLITE - INSERT does not return error but no data is inserted.

I am attempting to insert data into a local SQLITE database file from a C# application. The transaction does not throw any errors but the data is not inserted. The same insert statement works from within a query analyzer. Do I need to perform a commit? Is there a Commit method? Command's transaction property is null.. var command = ...

Experimenting with data to determine value - migration/methods?

Hey guys, I have a LOT of data available to me, and want to capture and experiment with data that isn't currently being used in production. I do not want to immediately add this to my existing data store since that would undoubtedly mess with production. The obvious solution seems to be to make a copy of production data and integrate it...

Database security / scaling question

Typically I use a database such as MySQL or PostGreSQL on the same machine as the application using it, which makes access easy and secure. I'm just now building the first site that will have a separate physical database server (later this year it will). I'm wondering 3 things: (security) What things should I look into for starters per...

SQL Syntax for multiple conditions in the same field

Possible Duplicate: Multiple OR Clauses in MySQL I can't seem to find this in the mysql manual: How do you enter multiple conditions for the same field in a select statement? e.g.: SELECT * FROM table WHERE ID = '1, 2, 3, 4' Is there a way to do this without using this: SELECT * FROM table WHERE ID = '1' OR ID = '2' OR I...

Is it possible to query the Magento database and display product attributes outside Magento?

I am building a site that needs to display some product info from a Magento Database, but display it on another page/site outside the Magento intallation. I know the information gets displayed twice, but I would like the site to avoid content duplication and pull that same info from an only source, the Magento product database. Is this ...

MySQL Limiting a query to one consistent value

My current query returns a table like: +------------+ value1 | .... value1 | .... value2 | .... value3 | .... +------------+ I want: +------------+ value1 | .... value1 | .... +------------+ I want to only receive all rows with the first value. Normally I would do a WHERE clause if I knew that value, and I cannot use a LIMIT becaus...

Modeling complex hierarchies

To gain some experience, I am trying to make an expert system that can answer queries about the animal kingdom. However, I have run into a problem modeling the domain. I originally considered the animal kingdom hierarchy to be drawn like -animal -bird -carnivore -hawk -herbivore -bluejay -mammals -carnivores ...

Why is it bad to use boolean flags in databases? And what should be used instead?

I've been reading through some of guides on database optimization and best practices and a lot of them suggest not using boolean flags at all in the DB schema (ex http://forge.mysql.com/wiki/Top10SQLPerformanceTips). However, they never provide any reason as to why this is bad. Is it a peformance issue? is it hard to index or query prope...

Database Design for a double entry accounting system

Should journal entries be recorded in a database design? In the real world it makes sense to keep a daily entry book, then later transfer the daily entry book into double entry accounts. but in the computerized version, doing this produces duplicate records and that doesn't quite make sense? Real life: User ---> journal day book (singl...

What are prepared statements?

What are prepared statements in the context of relational databases? How do they help and when should I consider using them? ...

Take data from an XML file and put it into a MySQL database

Hi Guys, I'm looking to construct a script that would go through an XML file. Would find specific tags in it, put them in a table and fill the table with specific tags within them. I'm using MySQL 5.1 so loadXML isn't an option and I think that ExtractData() method wont be much use either.. but I don't really know. What would be the bes...

My tricky SQL Update query not working so well.

I am trying to update a table in my database with another row from another table. I have two parameters one being the ID and another being the row number (as you can select which row you want from the GUI) this part of the code works fine, this returns one column of a single row. (select txtPageContent FROM (select *, Row_Number()...

How can i start a MultiThread Heavy Excel data to add Sql Table?

i want to start Multi Thread while adding 20000 rows Excel Data to sql data.How can i do that? (this is windows Application) ...