dbTalk Databases Forums  

How to find persons who like red fruits or crunchy veggies?

comp.databases comp.databases


Discuss How to find persons who like red fruits or crunchy veggies? in the comp.databases forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Neo
 
Posts: n/a

Default How to find persons who like red fruits or crunchy veggies? - 11-14-2006 , 11:16 PM






The following dbd query finds persons who like either red fruits or
crunchy veggies:

(and (select person instance *)
(select * like (or (and (select fruit instance *)
(select * color red))
(and (select veggie instance *)
(select * texture crunchy))
)
)
)

What RMDB schema and SQL query will find the equivalent? Should I start
with T_Person, T_Fruit, T_Veggie, T_PLikeF, T_PLikeV ?


Reply With Quote
  #2  
Old   
kvnkrkptrck@gmail.com
 
Posts: n/a

Default Re: How to find persons who like red fruits or crunchy veggies? - 11-15-2006 , 01:48 PM






In your language, can you query:
How many fruit colors are there? Which fruit color(s) is/are the most
liked? How many veggies are there that nobody likes?


Neo wrote:
Quote:
The following dbd query finds persons who like either red fruits or
crunchy veggies:

(and (select person instance *)
(select * like (or (and (select fruit instance *)
(select * color red))
(and (select veggie instance *)
(select * texture crunchy))
)
)
)

What RMDB schema and SQL query will find the equivalent? Should I start
with T_Person, T_Fruit, T_Veggie, T_PLikeF, T_PLikeV ?


Reply With Quote
  #3  
Old   
Neo
 
Posts: n/a

Default Re: How to find persons who like red fruits or crunchy veggies? - 11-15-2006 , 05:05 PM



Quote:
In your language, can you query:
How many fruit colors are there? [Yes]
Which fruit color(s) is/are the most liked? [No]
How many veggies are there that nobody likes? [No]
Currently dbd's NLI (SQL-type) interface implements very basic
functions such as create, select, update and delete (and a few others
listed at www.dbfordummies.com/NLI/function.asp).

Even modest functions such as MIN, MAX, etc would need to be
implemented by application interfacing to a db via API. See
www.dbfordummies.com/example/ex010b.asp which generates a nearest
common ancestor report for things in a hierarchy.

Below are the closest queries that dbd can perform via its NLI:

(; Count fruits)
(count (select fruit instance *))

(; Count colors for fruits)
(count (and (select color instance *)
(select (select fruit instance *) color *)))

(; Find veggies somebody likes)
(and (select veggie instance *)
(select (select person instance *) like *))



Reply With Quote
  #4  
Old   
Aloha Kakuikanu
 
Posts: n/a

Default Re: How to find persons who like red fruits or crunchy veggies? - 11-15-2006 , 06:27 PM



kvnkrkptrck (AT) gmail (DOT) com wrote:
Quote:
In your language, can you query:
How many fruit colors are there? Which fruit color(s) is/are the most
liked? How many veggies are there that nobody likes?
How about relational division type of queries?

i) find all job applicants who have all the skills (or find pilots that
can fly all the airplans)

ii)
table sets (
set# integer,
element integer
)

e.g. {{1,2,3},{3,4}}
set# element
---- ---------
1 1
1 2
1 3
2 3
2 4

find the intersection of the sets (i.e. all the elements that belong to
all the sets).



Reply With Quote
  #5  
Old   
michael@preece.net
 
Posts: n/a

Default Re: How to find persons who like red fruits or crunchy veggies? - 11-15-2006 , 09:50 PM




Neo wrote:
Quote:
The following dbd query finds persons who like either red fruits or
crunchy veggies:

(and (select person instance *)
(select * like (or (and (select fruit instance *)
(select * color red))
(and (select veggie instance *)
(select * texture crunchy))
)
)
)

What RMDB schema and SQL query will find the equivalent? Should I start
with T_Person, T_Fruit, T_Veggie, T_PLikeF, T_PLikeV ?
I like tomatoes. Imagine a world without them. No ketchup. No pizza
base. Are they fruit or veges? They're not especially crunchy though
anyway. What about red capsicums? Are they crunchy veges or fruit?



Reply With Quote
  #6  
Old   
Tonkuma
 
Posts: n/a

Default Re: How to find persons who like red fruits or crunchy veggies? - 11-16-2006 , 01:08 AM




Neo wrote:
Quote:
The following dbd query finds persons who like either red fruits or
crunchy veggies:

(and (select person instance *)
(select * like (or (and (select fruit instance *)
(select * color red))
(and (select veggie instance *)
(select * texture crunchy))
)
)
)

What RMDB schema and SQL query will find the equivalent? Should I start
with T_Person, T_Fruit, T_Veggie, T_PLikeF, T_PLikeV ?
For what dbd schema did you isuued this query? Would you show me exact
definition of dbd schema?



Reply With Quote
  #7  
Old   
Ed Prochak
 
Posts: n/a

Default Re: How to find persons who like red fruits or crunchy veggies? - 11-16-2006 , 09:27 AM




Tonkuma wrote:
Quote:
Neo wrote:
The following dbd query finds persons who like either red fruits or
crunchy veggies:

(and (select person instance *)
(select * like (or (and (select fruit instance *)
(select * color red))
(and (select veggie instance *)
(select * texture crunchy))
)
)
)

What RMDB schema and SQL query will find the equivalent? Should I start
with T_Person, T_Fruit, T_Veggie, T_PLikeF, T_PLikeV ?
For what dbd schema did you isuued this query? Would you show me exact
definition of dbd schema?
Please don't encourage Neo. He has an experimental system he created
himself. It is non-relational and "nonredundant" in the extreme. (e.g.,
he attempts to store the word red only once, whether it is used as the
color of fruit to someones nickname or a terrorist status).

Do a google search in this group is you feel like browsing nonsense.
Ed

Beware, there be trolls around here.



Reply With Quote
  #8  
Old   
Neo
 
Posts: n/a

Default Re: How to find persons who like red fruits or crunchy veggies? - 11-16-2006 , 09:52 AM



Quote:
For what dbd schema did you issued this query?
Would you show me exact definition of dbd schema?
Dbd's "schema" is approximately as follows:
A sheet of paper with infinite lines (limited by memory),
where each lines can have a sentence of any length (usually 3 words).

This "schema" permits the following example:

(new 'red 'color)
(new 'yellow 'color)
(new 'green 'color)

(new 'soft 'texture)
(new 'crunchy 'texture)

(new 'apple 'fruit)
(create apple color red)
(create apple texture crunchy)

(new 'banana 'fruit)
(create banana color yellow)
(create banana texture soft)

(new 'celery 'veggie)
(create celery color green)
(create celery texture crunchy)

(new 'zuchinni 'veggie)
(create zuchinni color green)
(create zuchinni texture soft)

(new 'tomato 'fruit 'veggie)
(create tomato color red)
(create tomato color yellow)
(create tomato color green)
(create tomato texture soft)

(new 'like 'verb)

(new 'john 'person)
(create john like banana)
(create john like celery)

(new 'mary 'person)
(create mary like apple)
(create mary like zuchinni)

(new 'bob 'person)
(create bob like banana)
(create bob like zuchinni)
(create bob like tomato)

(new 'sue 'person)
(create sue like banana)
(create sue like zuchinni)


(; Who likes red fruits or crunchy veggies?)
(; Finds john, mary and bob)
(and (select person instance *)
(select * like (or (and (select fruit instance *)
(select * color red))
(and (select veggie instance *)
(select * texture crunchy)))))


See www.dbfordummies.com/NLI/new.asp for details on new function.



Reply With Quote
  #9  
Old   
Neo
 
Posts: n/a

Default Re: How to find persons who like red fruits or crunchy veggies? - 11-16-2006 , 11:46 AM



Quote:
... store the word red only once, whether it is used as the color of fruit to someones nickname or a terrorist status).
(new 'red 'color)
(new 'red 'person)
(new 'red 'terrorStatus)

(; Find the class of things named red)
(; Returns color, person and terrorStatus)
(select * instance (select * name 'red))

New function details at www.dbfordummies.com/nli/new.asp



Reply With Quote
  #10  
Old   
Neo
 
Posts: n/a

Default Re: How to find persons who like red fruits or crunchy veggies? - 11-16-2006 , 03:34 PM



Quote:
find pilots that can fly all airplanes
How can I do this in SQL? Below script models the data in dbd, however
the query does not work (currently the function named ALL does not
exist).

(new 'fly 'verb)

(new 'jet1 'jet)
(new 'jet2 'jet)

(new 'pilot1 'pilot)
(create pilot1 fly jet1)

(new 'pilot2 'pilot)
(create pilot2 fly jet1)
(create pilot2 fly jet2)

(; Find pilots who fly all jets)
(; Does not work currently)
(and (select pilot instance *)
(select * fly (ALL (select jet instance *))))



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.