Hard Light Productions Forums

Off-Topic Discussion => General Discussion => Topic started by: Kazan on March 02, 2004, 11:24:59 am

Title: Henious SQL Queries
Post by: Kazan on March 02, 2004, 11:24:59 am
SELECT * FROM cmppeople WHERE Pos_Type='Scientists' ORDER BY Pos_Type,Pos_SubType,OrderOverride,SUBSTRING(Name, 1+Length(Name)-Locate(' ', REVERSE(Name))), SUBSTRING(Name, 1, Length(Name)-Locate(' ', REVERSE(Name)))
Title: Henious SQL Queries
Post by: 01010 on March 02, 2004, 01:30:41 pm
I don't get it, this isn't like one of CP's math jokes is it?
Title: Henious SQL Queries
Post by: aldo_14 on March 02, 2004, 01:33:01 pm
Quote
Originally posted by 01010
I don't get it, this isn't like one of CP's math jokes is it?


Database query.  I'd try to decipher it, but that colouring is giving me a headache :) *

* I know, I know - it's to clairfy the bracketing.  But i never liked SQL: anyways
Title: Henious SQL Queries
Post by: HotSnoJ on March 02, 2004, 01:56:45 pm
Probably has something to do with recent political/religious topics. :doubt:
Title: Henious SQL Queries
Post by: Kazan on March 02, 2004, 02:41:32 pm
HotSnoj: that comment was extremely presumptious and outright false

STFU ESAD
Title: Henious SQL Queries
Post by: Liberator on March 02, 2004, 02:43:56 pm
Kazan == :mad: :mad: :mad: :mad: :mad:  most of the time
Title: Henious SQL Queries
Post by: HotSnoJ on March 02, 2004, 03:04:56 pm
Quote
Originally posted by Kazan
HotSnoj: that comment was extremely presumptious and outright false

STFU ESAD
:wtf: am I suppose to think?
SELECT * FROM cmppeople WHERE Pos_Type='Scientists'

Also:
Quote
Probably has something to do with recent political/religious topics. :doubt:
Title: Henious SQL Queries
Post by: Kazan on March 02, 2004, 03:34:08 pm
HotSnoj: i work for DoE Ames Lab

you're suppose to think it has to do with my work - because IT DOES
Title: Re: Henious SQL Queries
Post by: aldo_14 on March 02, 2004, 03:48:13 pm
Quote
Originally posted by Kazan
SELECT * FROM cmppeople
WHERE Pos_Type='Scientists'
ORDER BY Pos_Type,Pos_SubType,OrderOverride,
SUBSTRING(Name, 1+Length(Name)-Locate(' ', REVERSE(Name))), SUBSTRING(Name, 1, Length(Name)-Locate(' ', REVERSE(Name)))


Well, it's been about 11/2 years since I last looked at SQL, so allow me some leeway here.........especially as this is off the top of my head

SELECT * - show all record fields in the selected tuples
WHERE Pos_Type='Scientists' - I presume pos-type is a field name?
ORDER BY Pos_Type,Pos_SubType,OrderOverride,
SUBSTRING(Name, 1+Length(Name)-Locate(' ', REVERSE(Name))), SUBSTRING(Name, 1, Length(Name)-Locate(' ', REVERSE(Name)))

- ORDER BY - in terms of priority, I think it's left-right (high-low) - Poa_type field, Pos_SubType field, OrderOverride field,

- now this next bit is a little hazy in particular, due to my unfamiliarity with the inbuild funcitons -

 SUBSTRING(Name, 1+Length(Name)-Locate(' ', REVERSE(Name))),
- the substring of the name field, taken from the last(?) whitespace

SUBSTRING(Name, 1, Length(Name)-Locate(' ', REVERSE(Name)))
- the substring of the name field, taken from the first(?) whitespace


So -
select and show all records
where pos_type (the field) is "Scientist"
order (the selected records) by Pos_type, Pos_SubType, OrderOverried, position of the last whitespace, position of the first whitespace (in order of priority)

Correct me it I'm wrong, it's nice to try and refresh these things from time to time.

EDIT: waittamo - this is (as a last resort)sorting by the length of the second or first name?
Title: Henious SQL Queries
Post by: HotSnoJ on March 02, 2004, 04:14:27 pm
Quote
Originally posted by Kazan
HotSnoj: i work for DoE Ames Lab

you're suppose to think it has to do with my work - because IT DOES
Quote
not that i speak from any form of experience, i'm 16.
Title: Henious SQL Queries
Post by: Kazan on March 02, 2004, 06:07:12 pm
HotSnoj: i didn't say im 16 - are you quoting yourelf there

I am 20
Title: Henious SQL Queries
Post by: mikhael on March 02, 2004, 06:10:27 pm
That was his point, Kaz. He's quoting him self by way of explaining why he didnt grok.
Title: Henious SQL Queries
Post by: Kazan on March 02, 2004, 06:11:53 pm
i knew SQL when i was 16, i knew C++ when i was 14....
Title: Henious SQL Queries
Post by: mikhael on March 02, 2004, 07:02:53 pm
HotSnoj==Kazan returns false, thus you cannot draw a direct parallel between HotSnoj and Kazan.
Title: Henious SQL Queries
Post by: Kazan on March 02, 2004, 07:05:48 pm
althought i can say that his unspoken propsition of "if (age == 16) sql_knowledge = NONE" is invalid
Title: Henious SQL Queries
Post by: aldo_14 on March 02, 2004, 07:23:09 pm
knows(x, SQL) ^ age(x,16)

{x/"Kazan"}

=> unifiable / satisfiable


alternately,

~knows(x, SQL) ^ age(x,16)

{x/"hotsnoj"}

=> unifiable / satisfiable
Title: Henious SQL Queries
Post by: mikhael on March 02, 2004, 08:03:52 pm
Absolutely, Kazan, however, when one adds the all important quantifier "person == 'hotsnoj'" we get the proper test:

if ((age == 16) && (person == 'hotsnoj') sql_knowledge = NONE

That is valid.
Title: Henious SQL Queries
Post by: Kazan on March 02, 2004, 08:54:06 pm
mikhael - it is correct WITH The additional quantifier -- however just saying the origional is invalid - and that is what hotsnoj implied
Title: Henious SQL Queries
Post by: Knight Templar on March 02, 2004, 09:05:19 pm
To take a note from DG: This thread == :no: :no:
Title: Henious SQL Queries
Post by: mikhael on March 02, 2004, 09:50:20 pm
Quote
Originally posted by Kazan
mikhael - it is correct WITH The additional quantifier -- however just saying the origional is invalid - and that is what hotsnoj implied


When he said "I'm only 16", he specified himself (hence the "I'm", thus the quantifier was both necessary and implicit, thus the original is valid.
Title: Henious SQL Queries
Post by: HotSnoJ on March 02, 2004, 10:14:04 pm
I know (my)SQL...to an extent.

Anyway, I looked again where I got that quote. I did it again damnit. Got two members mixed up, you and kasperl. damn.

Sorry Kazan. My sincerest apologies.


Oh and BTW, I'll be turning 18 in a few months


[EDIT] Yes, I did get what you were saying about me in pseudo-code.
Title: Henious SQL Queries
Post by: Thorn on March 03, 2004, 07:52:13 am
Wait... you're 16.. and turning 18 in a few months?
Ohhh.. must be the leap year... right.. thats it...
Title: Henious SQL Queries
Post by: aldo_14 on March 03, 2004, 07:56:29 am
Quote
Originally posted by Thorn
Wait... you're 16.. and turning 18 in a few months?
Ohhh.. must be the leap year... right.. thats it...


Surely that'd be 14-to-18?
Title: Henious SQL Queries
Post by: Martinus on March 03, 2004, 08:43:50 am
[color=66ff00]Feh.
[/color]