Countries
Example 1
Find the top 3 Countries from where Customers are from:
SELECT
Name as CountryName,
in('IsFromCountry').size() as NumberOfCustomers
FROM Countries
ORDER BY NumberOfCustomers DESC
LIMIT 3
In the Browse Tab of Studio, using the query above, this is the obtained list of records:
Example 2
Find Santo's Friends who are also Customers, and the Countries they are from:
MATCH {Class: Profiles, as: profile, where: (Name='Santo' AND Surname='OrientDB')}-HasFriend-{Class: Profiles, as: friend}<-HasProfile-{class: Customers, as: customer}-IsFromCountry->{Class: Countries, as: country}
RETURN $pathelements
In the Graph Editor included in Studio, using 'RETURN $pathelements' as RETURN
clause, this is the obtained graph:
In the Browse Tab of Studio, using 'RETURN friend.@Rid as Friend_RID, friend.Name as Friend_Name, friend.Surname as Friend_Surname, customer.@Rid as Customer_RID, customer.OrderedId as Customer_OrederedId, country.Name as FriendIsFrom' as RETURN
clause, this is the obtained list of records (only few records are shown in the image below):