[TIP!] SQL. New operator ->

Ruslan Zasukhin sunshine at public.kherson.ua
Mon Feb 7 20:25:46 CST 2005


Hi All,
Especially SQL lovers.

In this section I want introduce to you the new feature of
Valentina 2.0 SQL

    operator ->

* this feature is part of SQL99 btw.

* so Let you have in table Person the ObjectPtr field to table City.
            City - Person as 1 : M

* Let you want to see all persons and name of city where he lives.
What query you will do? Right, you will use JOIN:

    SELECT City.Name, Person.Name, Person.Surname,
    FROM City join Person ON city.RecID = Person.CityPtr

* Now ... take a brief! :-)
With 2.0 you can do this without join,
Your query is more simple and really more effective:

    SELECT CityPtr->Name, Name, Surname,
    FROM Person

As you see do query for SINGLE TABLE.
And we can pull into result table the fields from related ONE table(s)!
For this we use operator ->


* This operator must work with ObjectPtr, FK fields
    and with link_name (i.e. Again ObjectPtr, FK but with BinaryLink also)


---------------------
--------------
------
Oliver, your task with BinaryLink must looks as

    SELECT link_city_person->cityName, p.surname, count(*)
    FROM Person p
    GROUP BY link_city_person, p.surname

This will show City, Surname and how much people have it in this city.

This is what we will try to implement


-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------




More information about the Valentina-beta mailing list