How can we use SELECT ........ INTO <TABLE_NAME> other than just print output?

I am new to Tiger-Graoh GSQL and have SQL background. I am having hard time understanding how can i use Select Into result output to populate variable, or join with other vertex. I didn’t find much in the documentation.

You may benefit from more detailed examples of what you want to do. As someone that also has extensive SQL background, you will find that you have to change your way of thinking about queries.

For instance, there are no joins. Also, in general most of what you want to do can be achieved without using the SELECT INTO, although its useful in some scenarios, such as SQL-style grouping.

As far as the output of one query populating a variable, any vertex set that is a result of a query can become a variable name for a subsequent SELECT, like this:

STEP1 = SELECT x FROM Customers:x;
STEP2 = SELECT o FROM STEP1 -(HAS_ORDER>)- Orders:o;

1 Like

What I am trying to do is to get min(getvid(v)) , max(getvid(v)) and save them in 2 INT variables.

Use MinAccum and MaxAccum

Hello the following document link might help other who are new to gsql ,in gsql you can write the sql like statements

I hope this will help

1 Like