database

Rails - Shared Database Tables between two apps

We’ll be releasing shortly a companion Rails application to our existing Rails app. We will be running the companion app alongside our existing app on the same servers. My question concerns the databases. My hosting provider generally would configure a 2nd distinct database for the new application - secondappname_production. However,...

is there a common example SQL schema that shows all the major cardinalities?

I'm writing up documentation for a tool that works with SQL schemas. It would make sense for the documentation to use a common example schema rather than making up a new one. Any recommendations for one that's already defined somewhere? Ideally it would come from a problem domain most readers are already familiar with; have an examp...

rails style database migrations for asp.net?

I am in love with the rails style of updating db schema. I can define a migration as a class with fairly simple, yet powerful syntax. I can run the updates with a single command and all of my models are updated. They are committed to source control and can be easily read, modified, and undone. My current way of doing it for my asp.net m...

What is an existing library for making queries with the relational model?

I'm looking for a simple, high level library (implemented in python would be nice) for handling the relational algebra. Alternatively, an existing SQL implementation might have support for these queries. For example, if the relation schema of the account relation is (account id, name, balance), I'd like to input the expression here ...

Tracking database usage using php and Mysql

I am designing a php mysql webapp. In that, a database usage log has to be maintained , which will record 1.User ip 2.Timestamp 3.operation performed(Add,edit or delete) 4.Colmns changed 5.rowid 6.old value 7.new value Please suggest any example scripts. ...

Building a blog section.. How do I create a menu with all the dates so you can sort between time periods?

I'm currently working on creating my own blog section.. After brainstorming a little while I realized I'm a little stumped. I'm working with php and mysql (with codeigniter framework). The front blog page would show the top 5 post; this I can easily do. How would I go about creating a navigation that allows you to see the years that ...

jBASE 4.1 Database Noobster Questions

I am a software developer with devlopment experience in C#, C++ .Net alongwith SQL Server 2005/08, Oracle and mysql. But somehow i dont get jBASE to work at Windows XP SP3 machine. My goal is setup user accounts, create database on a JBASE ainstallation, authenticate and backup/restore few table via a C++ program. And i dont need to do ...

Database Query Help required in MySQL

I am looking for help in writing a query of retrieving the values from 2 tables in MySQL. The scenario is Table A ID Name Marks =================== 23 John 67 45 Mark 45 12 Ram 87 Table B has the following Structure ID Name Evaluation Marks ============================== 45 Mark 34 78 Chris...

Should I save image binary data to database or save images as files?

I have program that saves unique images that are related to unique database fields to database as binary fields or save in folders as image files? ...

What kind of index on dates for a emp duty table?

I have a query that gets all employee duties for a start date and end date against a database. Basically the table would be like Emp Duty StartDate EndDate Should I give indexing for dates? what kind etc? to make things easier on db level (orm level for me it would be an attribute to set).There will be huge data depending on number ...

Creating an efficient (but complex) NHibernate query.

Here is roughly our data model (the entity names are fake and only for example purposes). Product has a many-to-many relationship with Shipper. Shipper then has a one-to-many relationship with Warehouse. Basically: Product has many Shippers which have many Warehouses. We have a mapping from Product to Shipper and from Warehouse to Shi...

SQL queries through PYODBC fail silently on one machine, works on another

I am working on a program to automate parsing data from XML files and storing it into several databases. (Specifically the USGS realtime water quality service, if anyone's interested, at http://waterservices.usgs.gov/rest/WaterML-Interim-REST-Service.html) It's written in Python 2.5.1 using LXML and PYODBC. The databases are in Microso...

Design for simple database for an event stream

For a personal project, I want to record a stream of unrelated events, to gather simple statistics on later. Each event can have [wildly] different data associated with it. I'm looking for some advice on how to structure this. As this is a small project, my main goals are: Ease of setup Ease of use (i.e. no strange joins) Performanc...

sql delete lock

I execute a query in JDBC delete * from mytable where ... I got: java.sql.SQLException: The total number of locks exceeds the lock table size I have about 200k records in the table. how to fix this? ...

How the schema migration tools work?

I have db based application and I delete the schema & db content every time whenever there is any changes in the schema. Now it is in development mode. Soon we release the application in production. But we suspect there could be many changes after we release the application in production use. The software shall be installed on many loca...

What approach/design path should to take when building a totally new system?

This application I'm tasked with is basically a CRUD system for what will likely amount to about a dozen tables. The technology is likely ASP.NET WebForms + Ajax Ctrl Toolkit + jQuery on the front side, and SQL Server on the backside. This app will likely never be used by more than 10-20 users at a time as its a single-tenant system; ...

Single SQL query on many to many relationship

I have a simple database with few tables (and some sample columns): Posts (ID, Title, Content) Categories (ID, Title) PostCategories (ID, ID_Post, ID_Category) Is there a way to create single SQL query which will return posts with categories that are assigned to each post? ...

Syncronize databases

I am putting together a site made out of two scripts, with users. The 2 scripts have info about the members , they will act as one site so I need the users info to be the same on both. When the user fills in the info on the DB1 they should appear in the DB2 as well. The information fields I would need the same are basic: name, email, ...

Which SQL Query is Better?

Is this SQL query statement: SELECT p.id, p.[name], SUM(ps.sales_amount) AS GROSS_SALES FROM products p LEFT OUTER JOIN product_sales ps ON p.id = ps.product_id GROUP BY p.id, p.[name] better than: SELECT SUM([t2].[value]) AS [SalesAmount], [t2].[id] AS [ProductId], [t2].[name] AS [ProductName] FROM ( SELECT ( SELECT SU...

What is "Advanced" SQL?

Looking at a job descriptions where "advanced SQL" is a requirement. I can write basic queries as well as anyone, and have worked with MySQL databases in a professional setting, but what would I be getting into with these jobs, if I were to be hired? What are examples of advanced SQL and where am I along the scale of SQL noob to SQL ma...