[SQL] Nested set model

2001-08-17 Thread Renato De Giovanni
Hi, I'm trying the nested set model to handle a tree structure in a database (reference: http://www.dbmsmag.com/9603d06.html). It has many advantages if you want to select all nodes above or below a specific node (recursive calls aren't necessary), but when you want to select only the first

[SQL] Meta integrity

2001-07-25 Thread Renato De Giovanni
I'm working on a project based on an unusual data model. Some entities aren't represented by separate tables, they're grouped in the same table just like the following simplified model shows: CREATE TABLE class ( id CHAR(8) NOT NULL, name VARCHAR(30) NOT NULL, PRIMARY

Re: [SQL] Difficult SQL Statement

2001-05-30 Thread Renato De Giovanni
I have a table that has the following columns: AUTHOR_NO, ASMT_CODE, STATUS. The table would look something like this: AUTHOR_NO ASMT_CODE STATUS 12345 1 PASSED 12345 2 FAILED 12345 3 FAILED 12345 4 PASSED 12346 1 PASSED 12346 2

Re: [SQL] Left Joins...

2001-05-30 Thread Renato De Giovanni
I've got a nasty query that joins a table onto itself like 22 times. I'm wondering if there might be a better way to do this, and also how I can left join every additional table on the first one. By this I mean that if f1 matches my criteria and therefore isn't null, then every other joined

[SQL] Performance key data type

2001-01-18 Thread Renato De Giovanni
Hi, In Postgres, which one should be the best data type to be used as primary/foreign key considering query performance: INT or CHAR? Is there any "remarkable" difference between them? Thank you and regards, -- Renato Sao Paulo - SP - Brasil [EMAIL PROTECTED]

[SQL] Re: Querying date interval

2001-01-16 Thread Renato De Giovanni
select * from testdate where field1 between '2000-10-01' and '2000-11-30' ; field1 2000-09-30 why is it here?? 2000-10-20 2000-11-25 It works fine for me (7.0.3, Debian GNU/Linux "unstable"). I suspect your problem has to do with the "DATESTYLE"

[SQL] Querying date interval

2001-01-15 Thread Renato De Giovanni
Hi, Is there any SQL workaround to get the right results from the select statement bellow? Or am I doing something wrong?? create table testdate (field1 date); insert into testdate values ('2000-09-30'); insert into testdate values ('2000-10-20'); insert into testdate values ('2000-11-25');

Re: [SQL] Querying date interval

2001-01-15 Thread Renato De Giovanni
create table testdate (field1 date); insert into testdate values ('2000-09-30'); insert into testdate values ('2000-10-20'); insert into testdate values ('2000-11-25'); select * from testdate where field1 between '2000-10-01' and '2000-11-30' ; field1

Re: [SQL] Can I get this all in one query?

2000-08-28 Thread Renato De Giovanni
I don't have a postgresql instalation right now to do some tests, but maybe it works... SELECT crs.dept AS department, ROUND(AVG(CAST(rvs1.score AS FLOAT)) ,2) AS snooze, ROUND(AVG(CAST(rvs2.score AS FLOAT)) ,2) AS professional, ROUND(AVG(CAST(rvs3.score AS FLOAT)) ,2) AS

Re: [SQL] weird structure

2000-08-25 Thread Renato De Giovanni
Consider the following tables/fields: table "person": fields "p_id", "p_name". table "person_attribute": fields "a_id", "a_name". table "person_data": fields "d_person_id", "d_attribute_id", "d_value". Also consider that a person may not have data related to all possible