database

why is null not equal to null false

I was reading this article: http://stackoverflow.com/questions/191640/get-null-null-in-sql And the consensus is that when trying to test equality between two (nullable) sql columns, the right approach is: where ((A=B) OR (A IS NULL AND B IS NULL)) When A and B are NULL, (A=B) still returns FALSE, since NULL is not equal to NULL. That...

mySql problem in MySqlDataReader

MySqlDataReader rdr = cmd.ExecuteReader(); i have a some information in my mysqldatareader. how can i show it on our web-pages I don't know how i can use it .it means mysqldatareader. also welcome for simple source code. ...

Where to perform the data validation for a desktop application? On the database or in code?

In a single-user desktop application that uses a database for storage, is it necessary to perform the data validation on the database, or is it ok to do it in code? What are the best practices, and if there are none, what are the advantages and disadvantages of each of the two possibilities? ...

life span of temp table

I have the following procedure: CREATE PROCEDURE foo () SELECT * FROM fooBar INTO TEMP tempTable; -- do something with tempTable here DROP TABLE tempTable; END PROCEDURE; What happens if there is an exception before the DROP TABLE is called? Will tempTable still be around after foo exits? If so, foo could fail the next ...

Best way to learn MySql

i want to learn mysql. what i do for learn it. Currently i Read books on MySql. any other way for learn it ...

Looking for a local database for D2009+

I'm trying to update a legacy app that does all its data storage in a hacked-together system of BDE Paradox files. The program works pretty well, under certain narrow conditions, but it has serious performance issues. I'd like to try and improve things by updating to a better database system. What I need is a local database, preferably...

sql complex like expression @user

im trying to find all the mentions for the matched username (sam) from the database text code with following: $sql = "select * from tweet where feed like '%@sam%'"; this will return all the rows which user have been mention at. but now the problem is, it also returns rows with @sam3, @sam-dadf or anything that is after @sam.. how c...

testing inequality with columns that can be null

So, I asked a question this morning, which I did not phrase correctly, so I got a lot of responses as to why NULL compared to anything will give NULL/FALSE. My actual question was, what is the time honored fashion in which db guys test inequalities for two columns that can both be NULL. My question is the exact opposite of this questio...

Finding terabytes of data and using in oracle for learning purposes

Hey all, I am learning to be a dba, and the one thing i am missing is good quantity of data to handle a database with. Someone on irc said if you cant handle few terabytes of data then you are still not good enough. My question is, is there a way i can have terabytes of data from somewhere that i can use it for my learning pu...

restart multi-threaded perl script and close mysql connection

I have a Perl script that reads a command file and restarts itself if necessary by doing: myscript.pl: exec '/home/foo/bin/myscript.pl'; exit(0); Now, this works fine except for one issue. The thread that reads the command file does not have access to the DBI handle I use. And over a number of restarts I seem to build up the number o...

Python universal database interface?

Does there exist, or is there an intention to create, a universal database frontend for Python like Perl's DBI? I am aware of Python's DB-API, but all the separate packages are leaving me somewhat aggravated. ...

Sorting and i18n in Database

I have the following data in my db: ID Name Region 100 Sam North 101 Dam South 102 Wesson East ... ... ... Now, the region will be different in different languages. I want the Sorting to happen right, based on the display value rather than the internal value. Any Ideas? (And yeah, sorting in memory using Java is ...

Similarity Between Users Based On Votes

lets say i have a set of users, a set of songs, and a set of votes on each song: =========== =========== ======= User Song Vote =========== =========== ======= user1 song1 [score] user1 song2 [score] user1 song3 [score] user2 song1 [score] user2 song2 [score] user...

How do I show unique constraints of a table in MySQL?

I created them, but I forgot which ones they are. I just want to show them. remove all the constraints on a table. ...

How do I remove all unique keys from a table?

I have a table, and I just want to remove all unique constraints on it. I tried dropping the table and remaking it , but it won't work. There is still constraint. ...

Fixed Timetable DB Design

I want to let my users specify which hours / days they want to be contacted, I though of creating a fixed timetable with the 7 days of the week and let the user specify which hours he has free. I'm having a little trouble figuring out how I would store that info in the database, can anyone help me with a good table design for this situa...

Freezing database with Rails application

So for a class I have to turn in my Rails application to my professor. What is the best way to make sure everything goes smoothly when he trys to start it up? Also, is there anyway I can freeze a database and send that with it so he has all of the data I have been using in the application? Thanks a lot. ...

Does pytables support NULL ?

I have table looks like this ------------------ GeneId | ProteinId 1 | 157 2 | - 3 | 587 4 | 897 5 | - 6 | 120 In realational database, I can treat ProteinId column as INT and use NULL for "-" data. However, I can't find the same option in pytables. Does pytables support NULL...

Database Tables, more the better?

Lately I've been rethinking a database design I made a couple of months ago. The main reason is that last night I read the databse schema of vBulletin and saw that they use many, MANY, tables. The current "idea" I'm using for my schema, for instance my log table, is to keep everything in one table by differencing the type of Log with an...

sqlite_bind_?(character) how to bind characters in sqlite?

Hi all, May be its a silly question but I am a bit confused in it, I want to bind a character into sqlite database (neither as varchar, nor as text but as character only) Hence we can not use sqlite3_bind_text(insertStmt, 1, @"A", -1, SQLITE_TRANSIENT); So should I use sqlite_bind_int(insertStmt,1,65); or there is a better way t...