  We derive double product representations of nonterminating basic
hypergeometric series using diagonalization, a method introduced by Theo
William Chaundy in 1943. We also present some generating functions that arise
from it in the $q$ and $q$-inverse Askey schemes. Using this $q$-Chaundy
theorem which expresses a product of two nonterminating basic hypergeometric
series as a sum over a terminating basic hypergeometric series, we study
generating functions for the symmetric families of orthogonal polynomials in
the $q$ and $q$-inverse Askey scheme. By applying the $q$-Chaundy theorem to
$q$-exponential generating functions due to Ismail, we are able to derive
alternative expansions of these generating functions and from these, new
terminating basic hypergeometric representations for the continuous $q$-Hermite
and $q$-inverse Hermite polynomials are derived. These representations are
connected by new quadratic transformations for the terminating basic
hypergeometric series involved We also exploit duality relations for continuous
dual $q$-Hahn and continuous dual $q$-inverse Hahn with big $q$-Jacobi
polynomials and as well duality relations for Al-Salam--Chihara and $q$-inverse
Al-Salam--Chihara polynomials with little $q$-Jacobi polynomials to derive new
generating relations for the big and little $q$-Jacobi polynomials.
