database

Oracle Sequences

I'm using a Sequence to generate an id for me, but I use that sequence from my Java application. So say for example my last Id is 200. If I add an entry with .sql by by using 201 as an id instead of doing seq.nextval. What would happen when my java application calls seq.nextval? Is sequence smart enough to check the max available numbe...

Listing all tables in a database

Is there a SQL command that will list all the tables in a database and which is provider independent (works on MSSQLServer, Oracle, MySQL)? ...

I get "parent_id may not be NULL" when creating my Django model

I'm creating my own Group model; I'm not referring to the builtin Group model. I want each hroup to be a member of another group (it's parent), but there is the one "top" group that doesn't have a parent group. The admin interface won't let me create a group without entering a parent. I get the error personnel_group.parent_id may not be...

Is it possible to do a cross machine JOIN (i.e. cross DBs that are located on different machines) in mySQL?

I know in SQL Server this is possible using linked servers. Is there some analogous way to do this in mySQL? Thanks! ...

Replacing xml namespace prefixes in SQL Server with XQuery

I have an xml structure in an existing SQL Server 2005 database table with a particular namespace defined, I need to query out the XML and in the process, change the namespace prefix to become the default namespace. The old xml has the namespace defined on the root node and child nodes and I know how to replace the root easily enough, bu...

Problem installing pyscopg2 on Mac OS X

I have downloaded the latest build of pyscopg2 and have tried to build and install it using the directions provided. However i always get an error saying that 'w' is undeclared. Does anybody have any experience with this? ...

How can I put a database under git (version control)?

I'm doing a web app, and I need to make a branch for some major changes, the thing is, these changes require changes to the database schema, so I'd like to put the entire database under git as well. How do I do that? is there a specific folder that I can keep under a git repository? How do I know which one? How can I be sure that I'm pu...

Desktop application in java with database

I am trying to implement an application for a friend who sells t-shirts and hats, so we are dealing with interconnected tables. I was wondering what would be the perfect libraries to achieve this goal. What kind of database should I use to make it portable and easy to deploy. I would really like to insist on the database stuff, what shou...

SQLite for blackberry

Hi , Is sqlite available for blackberry?.Is any other option available other than that .... ...

Select Mysql commutative sum of each row

I want to achieve by mysql query +------+---------+ | frq | -any- | +------+---------+ | 10 | 10 | | 15 |10+15=25 | | 15 |25+15=40 | +------+---------+ please help with code references, thanks ...

I want when I fill my database ,if a value is REPETITIOUS ,then appeared error

hello. I use this code till I see data in my database and edit,delet and insert data in that . but I want when I insert data to database , that is not REPETITIOUS , and if that is REPETITIOUS show me a message box about it. Code : private void btnok_Click(object sender, EventArgs e) { string id = idTextBox.Text.ToString();...

Understanding database inserts

Most databases support some form of "insert into select..." statement. insert into a select value from b; How is this being achieved? My understanding: The rows that are present at that point of time when the statement starts execution qualify to be picked up, and they are inserted into table a. At the same-time new values can be in...

how to create windows applications in VB.Net or ASP.Net

which method is more efficient to use: DataAdapter and DataSet Or DataReader when importing data from a certain database table??? ...

I have a database diagram in Microsoft Visio how can i import it to Sql Server 2005?

I have done a database diagram in Microsoft Visio but I don't know how to import it to Sql Server 2005? By the way, which is the best tool you think you can use to do database diagrams, and that allows you to import it to Sql Server? ...

Will View Increase The Performance?

I have Six tables which will joined in many queries.If a View created by joining all the tables will increase the performance?.Is there are any alternatives to increase the performance?. I am using oracle as the database and all the joined columns are indexed. ...

Select n random rows from SQL Server table

I've got a SQL Server table with about 50,000 rows in it. I want to select about 5,000 of those rows at random. I've thought of a complicated way, creating a temp table with a "random number" column, copying my table into that, looping through the temp table and updating each row with RAND(), and then selecting from that table where the ...

File access speed vs database access speed

The site I am developing in php makes many MySQL database requests per page viewed. Albeit many are small requests with properly designed index's. I do not know if it will be worth while to develop a cache script for these pages. 1) Are file I/O generally faster than database requests? Does this depend on the server? Is there a way to ...

Creating Models in ASP.NET MVC

I'm just starting a project in ASP.Net MVC with LINQ to Entities and I was wondering if there was a nice, clean way of defining models that creates the appropriate tables in the database for me. I'm most familiar with Django (in terms of MVC frameworks) and am looking for the .Net equivalent of models.py so I can have everything versione...

Conditional column for query based on other columns in MySQL

I'm pretty sure I've seen this somewhere, but I can't find the right terminology so I'm having trouble... Let's say I have a table with user info (let's also assume that it was created by someone who gets paid more than me, so modifying the schema is not an option.) Among the various columns of user info are columns for DOB and job titl...

Persistent Layer Validations

While saving data using a stored procedure often we encounter foreign key constraints, unique key constraints, etc. All such errors can be corrected by passing in the right data. Validation can be done in the business logic layer and should be sent to the persistence layer only if it succeeds. But in some cases it is convenient to valid...