database

about null values!

Hi I have a question that if we declare a variable and then do not set it explicitly to null value then it would be null outomatically ,i mean that the below code will return true or false ? thanks DECLARE @val CHAR(4) If @val = NULL ...

What are some strategies for maintaining a common database schema with a team of developers and no DBA?

I'm curious about how others have approached the problem of maintaining and synchronizing database changes across many (10+) developers without a DBA? What I mean, basically, is that if someone wants to make a change to the database, what are some strategies to doing that? (i.e. I've created a 'Car' model and now I want to apply the appr...

what is "=null" and " IS NULL"

I want some links for reading about the "=null" and "is null" please help me thanks ...

what does "out of range" mean?

Hi I have checked these statements with mysql and no error will happen and also the out put will be 0 rows BUT my friend checked it and he found an error for SELECT becaouse it is out of range !! IS he correct? thanks CREATE TABLE T1(A INTEGER NULL); SELECT * FROM T1; ...

what is the out put?

Hi this is my code but when I run it in mysql it will show an error because of datatype but my friend checked it with sql server and it doesn't show error and also insert the value: 32769 .which of them is correct? CREATE TABLE T1 (A INTEGER NOT NULL); INSERT T1 VALUES (32768.5); ...

Could a hashing algorithm be used to save space in a database?

I have been using git a lot recently and I quite like the concept of how GIT avoid duplicating similar data by using a hashing function based on sha1. I was wondering if current databases do something similar, or is this inefficient for some reason? ...

When to use @Singleton in a Jersey resource

I have a Jersey resource that access the database. Basically it opens a database connection in the initialization of the resource. Performs queries on the resource's methods. I have observed that when I do not use @Singleton, the database is being open at each request. And we know opening a connection is really expensive right? So my q...

How to create a table in a particular database?

The create database statement is: CREATE TABLE table_name ( column_name1 data_type, column_name2 data_type, column_name3 data_type, .... ) but, I'm wondering how can I create a table in a specific database? thanks, guys! ...

SQLite connection pooling with Fluent NHibernate

Is there a way to setup SQLite connection pooling using Fluent NHibernate configuration? E.g. equivalent of DataSource=:memory: would be: var sessionFactory = Fluently .Configure() .Database(SQLiteConfiguration.Standard.InMemory) (etc.) Is there something eqivalent to "Pooling=True;Max Pool Size=1;"? ...

question with its query

Hi this is my homework and the question is this: List the average balance of customers by city and short zip code (the first five digits of thezip code). Only include customers residing in Washington State (‘WA’). also the Customer table has 5 columns(Name,Family,CustZip,CustCity,CustAVGBal) I wrote the query like below is this correct?...

migrate/ update core data app without erasing user data!

hello, i have a very complicated problem that i would like to share with you and maybe someone can answer it for me. before i start i have to say that i am very new in this. So, i have a coredata iphone app (much like the recipes app) that uses a pre-populated sql database. The user can add/edit his own data but the default data cannot ...

[netbeans] inlcude H2 database to use netbeans GUI with it

Hi all, is possible include H2 database in netbeans to use it with the GUI to create table ecc ecc? Like javadb integration i means.. ...

sqlite3 date operations when joining two tables in a view?

In short, how to add minutes to a datetime from an integer located in another table, in one select statement, by joining them, in sqlite3? I have a sqlite3 db with: table P(int id, ..., int minutes) and a table S(int id, int p_id, datetime start) I want to generate a view that gives me PS(S.id, P.id, S.start + P.minutes) by joining S....

Database class is not correctly connecting to my database.

I'm just venturing into the world of OOP so forgive me if this is a n00bish question. This is what I have on index.php: $dbObj = new Database(); $rsObj = new RS($dbObj); This is the Database class: class Database { private $dbHost; private $dbUser; private $dbPasswd; private $dbName; private $sqlCount; funct...

What are appropriate ways to represent relationships between people in a database table?

I've got a table of people - an ID primary key and a name. In my application, people can have 0 or more real-world relationships with other people, so Jack might "work for" Jane and Tom might "replace" Tony and Bob might "be an employee of" Rob and Bob might also "be married to" Mary. What's the best way to represent this in the databa...

Question about joins and table with Millions of rows

I have to create 2 tables: Magazine ( 10 millions of rows with these columns: id, title, genres, printing, price ) Author ( 180 millions of rows with these columns: id, name, magazine_id ) . Every author can write on ONLY ONE magazine and every magazine has more authors. So if I want to know all authors of Motors Magazine, I have to ...

I need to authenticate against one db with python and openfire. How do I do this?

Its not urgent but I was just wondering how one would go about authenticating against a single db using python and openfire? Is there a simple module that will do this? ...

How do you deal with denormalization / secondary indexes in database sharding?

Say I have a "message" table with 2 secondary indexes: "recipient_id" "sender_id" I want to shard the "message" table by "recipient_id". That way to retrieve all messages sent to a certain recipient I only need to query one shard. But at the same time, I want to be able to make a query that ask for all messages sent by a certain sen...

Question about Benchmark function in Mysql ( Incredible results ).

I have 2 tables: author with 3 millions of rows. book with 20 miles rows. . So I have benchmarked this query with a join: SELECT BENCHMARK(100000000, 'SELECT book.title, author.name FROM `book` , `author` WHERE book.id = author.book_id ') And this is the result: Query took 0.7438 sec ONLY 0.7438 seconds for 100 millions of que...

Saving images in database mysql

My client have created a script in php+mysql that saves images directly in the database and every images has url like this: www.example.com/image.php?id=421 In your opinion this is a very wrong solution ? Should I rebuild all the site ? There are about 1000 visits per day and about 600 images in the database. This is the site: http://...