Google Sheets Query function: The Most Powerful Function in Google Sheets

Custom functions used in Google Sheets for ease of use and improved functionality.

The most powerful built-in function in Google Sheets

=gsSQL("select invoice, date from booksales where date >= ?1 and date <= ?2", "booksales", booksalesTABLE, true, startDate, endDate)

invoice	date
I7202	5/2/2022
I7203	5/2/2022
I7204	5/3/2022
I7204	5/3/2022
I7204	5/3/2022
I7205	5/4/2022
I7206	5/4/2022
=gsSQL(
    "SELECT books.id, books.title, authors.first_name, authors.last_name 
        FROM books 
        INNER JOIN authors 
        ON books.author_id = authors.id 
        ORDER BY books.id")

books.id	books.title	        authors.first_name	authors.last_name
1	        Time to Grow Up!	Ellen	            Writer
2	        Your Trip	        Yao	                Dou
3	        Lovely Love	        Donald	            Brain
4	        Dream Your Life	    Ellen	            Writer
5	        Oranges	            Olga	            Savelieva
6	        Your Happy Life	    Yao	                Dou
7	        Applied AI	        Jack	            Smart
8	        My Last Book	    Ellen	            Writer
=QUERY( ArrayFormula(
     LET(
          lt, Books!A2:F10, lt_id, Books!D2:D10, rt, Authors!A2:C6, rt_id, Authors!A2:A6, 
          look_up, VLOOKUP(lt_id, HSTACK(rt_id, rt), SEQUENCE(1, COLUMNS(rt), 2), 0), 
          merge, HSTACK(lt, look_up), 
          FILTER(merge, CHOOSECOLS(look_up, 1)<>"")
     )
), "select Col1, Col2, Col8, Col9")

1	        Time to Grow Up!	Ellen	            Writer
2	        Your Trip	        Yao	                Dou
3	        Lovely Love	        Donald	            Brain
4	        Dream Your Life	    Ellen	            Writer
5	        Oranges	            Olga	            Savelieva
6	        Your Happy Life	    Yao	                Dou
7	        Applied AI	        Jack	            Smart
8	        My Last Book	    Ellen	            Writer

gsSQL.js