On 20 Sep 2015, at 7:15pm, James K. Lowden wrote:
> Simon Slavin wrote:
>
>> Constructions like this
>>
>>> INSERT INTO _TAG_EXISTS_RESULT_ ( NAME, BOOL )
>>> SELECT 'evil little sister'
>>
>> should be rewritten so that you are not trying to do a SELECT in the
>> middle of your INSERT.
>
On Sun, 20 Sep 2015 19:33:35 +0100
Simon Slavin wrote:
> On 20 Sep 2015, at 7:15pm, James K. Lowden
> wrote:
>
> > Simon Slavin wrote:
> >
> >> Constructions like this
> >>
> >>> INSERT INTO _TAG_EXISTS_RESULT_ ( NAME, BOOL )
> >>> SELECT 'evil little sister'
> >>
> >> should be rewritten
On Wed, 16 Sep 2015 08:23:04 +1000
Barry Smith wrote:
> As for your original query: think about just the select clause (you
> can run it independently). This will return ('magnetohydrodynamics',
> 1) for each row in the table.
It took me a bit to understand what you meant. I also think
On Wed, 16 Sep 2015 19:40:23 +0100
Simon Slavin wrote:
> Constructions like this
>
> > INSERT INTO _TAG_EXISTS_RESULT_ ( NAME, BOOL )
> > SELECT 'evil little sister'
>
> should be rewritten so that you are not trying to do a SELECT in the
> middle of your INSERT.
Why in the world would you
On 2015-09-18 03:13 AM, Keith Medcalf wrote:
>> Some initial things.
>
>> Data needs to be kept in 1NF (or 1st-Normal-Form) which is relational
>> theory speak for "Everything without a 1-to-1 relationship with the key
>> field in a table, should be in another table". Many reasons for this
>>
On 2015-09-17 05:13 AM, Nicolas J?ger wrote:
> @Ryan,
>> To get you started on this road, may I ask you take a leap of faith
>> and explain to us from A to Z what you would like to achieve with the
>> tables and data you are asking about above - i.e don't show us the
>> programming you think
> Some initial things.
> Data needs to be kept in 1NF (or 1st-Normal-Form) which is relational
> theory speak for "Everything without a 1-to-1 relationship with the key
> field in a table, should be in another table". Many reasons for this
> (if you care to read up on some RT) but the most
On 2015-09-16 08:27 PM, Nicolas J?ger wrote:
> Hi guys,
>
> so there is the two ways I made:
>
> FIRST ONE:
> ==
>
> ** Create a table wich will store the result of EXISTS,
>
> CREATE TABLE _TAG_EXISTS_RESULT_( NAME, BOOL );
>
>
> ** The next query has to INSERT 'evil little sister' with
Hi,
@Simon,
> >CASE ( SElECT BOOL FROM _TAG_EXISTS_RESULT_ ) WHEN 0
>
> CASE takes a value. You can't put a SQLite command in there.
>
actually, it's working if you put the command between (). I guess it's
like the `` on linux (eg),
mplayer `ls *.mp3`
but maybe,even if it's working, you
> @Simon,
>
> > >CASE ( SElECT BOOL FROM _TAG_EXISTS_RESULT_ ) WHEN 0
> >
> > CASE takes a value. You can't put a SQLite command in there.
> >
> actually, it's working if you put the command between (). I guess it's
> like the `` on linux (eg),
>
> mplayer `ls *.mp3`
>
> but maybe,even if
On 16 Sep 2015, at 7:27pm, Nicolas J?ger wrote:
>CASE ( SElECT BOOL FROM _TAG_EXISTS_RESULT_ ) WHEN 0
CASE takes a value. You can't put a SQLite command in there.
More generally, you come from a programming background and are expecting SQL to
work like a programming language. It
Hi guys,
so there is the two ways I made:
FIRST ONE:
==
** Create a table wich will store the result of EXISTS,
CREATE TABLE _TAG_EXISTS_RESULT_( NAME, BOOL );
** The next query has to INSERT 'evil little sister' with BOOL to 1 in
_TAG_EXISTS_RESULT_ if 'evil little sister' is
If you have a unique index on name, you could use INSERT OR IGNORE.
https://www.sqlite.org/lang_conflict.html
INSERT OR IGNORE INTO TAGS (NAME, COUNT) VALUES ('Bleh', 1)
As for your original query: think about just the select clause (you can run it
independently). This will return
On 2015-09-15 06:01 PM, Nicolas J?ger wrote:
> hi Keith, hi others,
>
>> If there should only be one entry for each name (and it is not case
>> sensitive),
> I'm using sqlite trough a C++ program wich take care of the case
> sensitive. In this very case, each entry has to be unique.
Fine, but
Hi people!
@Ryan,
> Fine, but do think of if you ever might want to use the DB via
> anything else, or a DB admin program... best is to ensure the DB
> schema itself knows the collation and case sensitivity requirements.
On 15 Sep 2015, at 5:01pm, Nicolas J?ger wrote:
> I also would like to know how can I check if an entry exists,(or not
> exists), in a table. Like,
>
> IF (exists) THEN (doSomething) END
Here's another alternative to add to those in Ryan's excellent post. With your
schema
> create table
On 9/15/2015 2:04 PM, John McKown wrote:
> sqlite> select count(a) from x;
Better still:
select exists (select 1 from x);
The difference is that the version with count() always scans the whole
table, while the latter stops at the first record - which is good enough
if you only need to check
Very good! I'll keep that one.
On Tue, Sep 15, 2015 at 1:26 PM, Igor Tandetnik wrote:
> On 9/15/2015 2:04 PM, John McKown wrote:
>
>> sqlite> select count(a) from x;
>>
>
> Better still:
>
> select exists (select 1 from x);
>
> The difference is that the version with count() always scans the
On Tue, Sep 15, 2015 at 12:43 PM, Simon Slavin wrote:
>
> On 15 Sep 2015, at 5:01pm, Nicolas J?ger wrote:
>
> > I also would like to know how can I check if an entry exists,(or not
> > exists), in a table. Like,
> >
> > IF (exists) THEN (doSomething) END
>
> Here's another alternative to add to
hi Keith, hi others,
> If there should only be one entry for each name (and it is not case
> sensitive),
I'm using sqlite trough a C++ program wich take care of the case
sensitive. In this very case, each entry has to be unique.
> your best bet would be to declare that NAME is unique:
>
>
hi,
I have a table TAGS with idkey and two colums (NAME, COUNT):
id|NAME|COUNT
53|black metal|3
55|occult rock|3
61|satanic smurfs|1
62|beer|0
63|pizza|0
I want to check if some tag exist by checking if `NAME` is recorded
in the table or not. If not, I want to add it;
INSERT INTO TAGS ( NAME,
hi,
I have a table TAGS with idkey and two colums (NAME, COUNT):
id|NAME|COUNT
53|black metal|3
55|occult rock|3
61|satanic smurfs|1
62|beer|0
63|pizza|0
I want to check if some tag exist by checking if `NAME` is recorded
in the table or not. If not, I want to add it;
INSERT INTO TAGS ( NAME,
On Monday, 14 September, 2015 21:07, Nicolas J?ger
said:
> hi,
> I have a table TAGS with idkey and two colums (NAME, COUNT):
> id|NAME|COUNT
> 53|black metal|3
> 55|occult rock|3
> 61|satanic smurfs|1
> 62|beer|0
> 63|pizza|0
> I want to check if some tag exist by checking if `NAME` is
23 matches
Mail list logo