Ниже для BigQuery Standard SQL
#standardSQL
SELECT *
FROM `project.dataset.table`
WHERE 2 =
(SELECT COUNT(1)
FROM UNNEST(components)
WHERE (type, model_name) IN (
('Sound', 'SoundBlaster'), ('CPU', 'Core i7')
)
)
Вы можете проверить, поиграть с выше, используя фиктивные данные из вашего вопроса, как показано ниже
#standardSQL
WITH `project.dataset.table` AS (
SELECT 1 hw_id, 'Lenovo' manufacturer, 'ABX' model, [STRUCT<type STRING, model_name STRING>('GPU', 'Radeon 5500'), ('CPU', 'Core i7'), ('SCSI Controller', 'Adaptec 2940')] components, 16 ram, 1000 hdd UNION ALL
SELECT 2, 'Dell', 'ZXV', [('CPU', 'Core i7'), ('GPU', 'GeForce'), ('Sound', 'SoundBlaster')], 4, 500 UNION ALL
SELECT 3, 'IBM', 'PS/2', [('CPU', 'i386'), ('Sound', 'SoundBlaster'), ('GPU', 'GeForce')], 1, 100
)
SELECT *
FROM `project.dataset.table`
WHERE 2 =
(SELECT COUNT(1)
FROM UNNEST(components)
WHERE (type, model_name) IN (
('Sound', 'SoundBlaster'), ('CPU', 'Core i7')
)
)
так что результат будет
hw_id | manufacturer | model | components.type | components.model_name | ram | hdd
------+--------------+-------+-----------------+-----------------------+-----+-----
2 | Dell | ZXV | CPU | Core i7 | 4 | 500
| | | GPU | GeForce | |
| | | Sound | SoundBlaster | |