Re: [sqlite] ISNULL in sqlite

2011-06-27 Thread logan...@gmail.com
Yes, I'm checking for empty string, but it wasn't working for null. The
suggestions by kind people here helped resolve it. Thank you!

On Mon, Jun 27, 2011 at 11:16 AM, Gerry Snyder <mesmerizer...@gmail.com>wrote:

> On 6/25/2011 12:33 PM, logan...@gmail.com wrote:
> > Hello,
> >
> > How do I check for a null or empty string in SQLite.
>
> In addition to the other replies you have received, you need to be made
> aware that an empty string and a NULL are very different, and (perhaps)
> both have to be checked for, depending on how the data gor into the table.
>
>
> Gerry
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] ISNULL in sqlite

2011-06-27 Thread logan...@gmail.com
Thank you everyone!!

On Sat, Jun 25, 2011 at 9:27 PM, Jay A. Kreibich <j...@kreibi.ch> wrote:

> On Sat, Jun 25, 2011 at 04:55:13PM -0400, Igor Tandetnik scratched on the
> wall:
> > logan...@gmail.com wrote:
> > > How do I check for a null or empty string in SQLite. SQL server has
> ISNULL
> > > but it doesn't seem to be supported in SQLite.
> >
> > where MyField is null
>
>   where MyField isnull is also supported.
>
>  http://www.sqlite.org/lang_expr.html  ("is null" is just a standard
>  "is" with the right side expression being a literal NULL.)
>
>
>
>   -j
>
> --
> Jay A. Kreibich < J A Y  @  K R E I B I.C H >
>
> "Intelligence is like underwear: it is important that you have it,
>  but showing it to the wrong people has the tendency to make them
>  feel uncomfortable." -- Angela Johnson
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] ISNULL in sqlite

2011-06-25 Thread logan...@gmail.com
Hello,

How do I check for a null or empty string in SQLite. SQL server has ISNULL
but it doesn't seem to be supported in SQLite.

Thanks,
Hitesh
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Indexes on columns

2011-06-24 Thread logan...@gmail.com
Ahh..ok, thanks for the response everyone. I really appreciate the help here
:).

On Fri, Jun 24, 2011 at 11:10 AM, Igor Tandetnik <itandet...@mvps.org>wrote:

> On 6/24/2011 1:58 PM, logan...@gmail.com
> wrote:
> > Sorry, but seems like I'm missing something here.
> >
> >  From my understanding it looks like for Integer ID columns that are PK
> > SQLite doesn't generate any indexes. Is this true?
>
> It's true in a narrow technical sense, but it doesn't matter in practice.
>
> In SQLite, data is organized in B-trees. Each table and each index is a
> B-tree. For an index, the key into that B-tree is the set of fields the
> index is built on. For a table, each row has a unique integer
> identifier, usually referred to as RowId, which serves as a key into the
> table's B-tree. Looking up a row in the table by its RowId is as fast as
> looking up an index entry by its key, because it's really the same
> operation.
>
> When you declare a column as INTEGER PRIMARY KEY, SQlite simply makes it
> an alias for an already-existing, always-present RowId column. Again,
> the table itself essentially acts as an index on this column, no
> additional external data structure is necessary.
> --
> Igor Tandetnik
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Indexes on columns

2011-06-24 Thread logan...@gmail.com
Sorry, but seems like I'm missing something here.

>From my understanding it looks like for Integer ID columns that are PK
SQLite doesn't generate any indexes. Is this true?

If the above is true then I want to create an index to improve the perf of
my queries that are run against it.

Thanks,
Hitesh

On Fri, Jun 24, 2011 at 5:31 AM, Igor Tandetnik <itandet...@mvps.org> wrote:

> logan...@gmail.com wrote:
> > Yes, that's exactly what it is. Here is the definition of one of the
> table:
> >
> > CREATE TABLE [Attributes] (
> > [Id] INTEGER  NOT NULL PRIMARY KEY AUTOINCREMENT,
> > [Name] VARCHAR(50)  NOT NULL
> > )
> >
> > Will creating explicit index on Id fix this issue?
>
> What issue? Why is having an explicit index, separate from that built into
> the table itself, important to you? What exactly do you feel is wrong with
> the way things are now?
> --
> Igor Tandetnik
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Indexes on columns

2011-06-24 Thread logan...@gmail.com
Yes, that's exactly what it is. Here is the definition of one of the table:

CREATE TABLE [Attributes] (
[Id] INTEGER  NOT NULL PRIMARY KEY AUTOINCREMENT,
[Name] VARCHAR(50)  NOT NULL
)

Will creating explicit index on Id fix this issue?

Thanks.

On Thu, Jun 23, 2011 at 11:07 PM, Dan Kennedy <danielk1...@gmail.com> wrote:

> On 06/24/2011 12:26 PM, logan...@gmail.com wrote:
> > Hello,
> >
> > My understanding is that an index is automatically created on any column
> > that is used in the primary key (or a composite index is created if the
> key
> > is composed of different columns). If this is correct then why don't I
> see
> > indexes for those in my table (I'm using SQLite Administrator and Firefox
> > plugin based SQLite manager). I do see indexes for the columns that I
> added
> > a unique constraint upon.
> >
> > Is the above just a GUI error in these tools or an index need to be
> created
> > separately on the columns used in primary keys?
>
> Maybe your tables have "integer primary keys". Those are an exception
> See here:
>
>   http://www.sqlite.org/lang_createtable.html#rowid
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Indexes on columns

2011-06-23 Thread logan...@gmail.com
Hello,

My understanding is that an index is automatically created on any column
that is used in the primary key (or a composite index is created if the key
is composed of different columns). If this is correct then why don't I see
indexes for those in my table (I'm using SQLite Administrator and Firefox
plugin based SQLite manager). I do see indexes for the columns that I added
a unique constraint upon.

Is the above just a GUI error in these tools or an index need to be created
separately on the columns used in primary keys?

Thanks,
Hitesh
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users