Is the following the closest, least verbose way to emulate a VALUES clause in BigQuery?
WITH Roster AS
(SELECT * FROM UNNEST([
STRUCT('Adams' as LastName, 50 as SchoolID),
('Buchanan', 52),
('Coolidge', 52),
('Davis', 51),
('Eisenhower', 77)
])) SELECT * FROM Roster
The old way I was doing and what Google uses in their docs is something like:
WITH Roster AS
(SELECT 'Adams' as LastName, 50 as SchoolID UNION ALL
SELECT 'Buchanan', 52 UNION ALL
SELECT 'Coolidge', 52 UNION ALL
SELECT 'Davis', 51 UNION ALL
SELECT 'Eisenhower', 77)
SELECT * FROM Roster
In Postgres or something I'd do:
WITH Roster(LastName, SchoolID) AS (
VALUES('Adams', 50),
('Buchanan', 52),
('Coolidge', 52),
('Davis', 51),
('Eisenhower', 77)
) SELECT * FROM Roster
Which is quite similar to the first approach.