如何在不使用 bigquery 中的键的情况下加入多个 table
How to join multiple table without using a key in bigquery
Table 名称和架构
Table 1:student table
column name : student_name, student_address, student_mark
Table 2:staff table
Column name: Staff_name, Staff_address, Staff_age, staff_class
Table 3: alumni table
Column name: alumni_name, alumni_address, alumni_year_passing, Alumni_marks, alumni_work_details
我打算使用 Bigquery 将包含空列数的 table 显示为所有三个 table。 构造 null table
的架构
student_name_null_pct float,
student_address_null int,
student_address_null_pct float,
student_mark_null int,
Staff_name_null int,
Staff_address_null int,
staff_class_null int,
alumni_name_null int,
alumni_address_null int,
alumni_year_passing_null int
在 bigquery 中使用了结构
SELECT
( (
SELECT
AS STRUCT student_name_null,
ROUND(SAFE_DIVIDE(student_name_null,
total_rows), 5) AS student_name_null_pct,
student_address,
ROUND(SAFE_DIVIDE(student_address,
total_rows), 5) AS student_address_pct
FROM (
SELECT
CURRENT_DATE() AS date,
COUNT(*) AS total_rows,
COUNTIF(student.student_name IS NULL) AS student_name_null,
COUNTIF(distributors.student_address IS NULL) AS student_address,
COUNTIF(distributors.student_mark IS NULL) AS student_mark
FROM
`school.student_table` AS student)),
(
SELECT
AS STRUCT total_rows_staff,
Staff_name,
ROUND(SAFE_DIVIDE(Staff_name,
total_rows_staff), 5) AS Staff_name_pct,
brand_title,
ROUND(SAFE_DIVIDE(Staff_address,
total_rows_staff), 5) AS Staff_address_pct
FROM (
SELECT
COUNT(*) AS total_rows_staff,
COUNTIF(products.Staff_name IS NULL) AS Staff_name,
COUNTIF(products.Staff_address IS NULL) AS Staff_address,
FROM
`school.staff_table` AS staff))
在结构中获取结果不能用于我排除的模式。请帮助我解决问题。
SELECT
CURRENTDATE() AS date,
student_name_null,
ROUND(SAFE_DIVIDE(student_name_null,
total_rows), 5) AS student_name_null_pct,
student_address,....
FROM (
SELECT
COUNT(*) AS total_rows,
COUNTIF(student.student_name IS NULL) AS student_name_null,
COUNTIF(distributors.student_address IS NULL) AS student_address,
COUNTIF(distributors.student_mark IS NULL) AS student_mark
FROM
`school.student_table` AS student),
(
SELECT
COUNT(*) AS total_rows_staff,
COUNTIF(products.Staff_name IS NULL) AS Staff_name,
COUNTIF(products.Staff_address IS NULL) AS Staff_address,
FROM
`school.staff_table` AS staff))
这解决了我的问题
Table 名称和架构
Table 1:student table
column name : student_name, student_address, student_mark
Table 2:staff table
Column name: Staff_name, Staff_address, Staff_age, staff_class
Table 3: alumni table
Column name: alumni_name, alumni_address, alumni_year_passing, Alumni_marks, alumni_work_details
我打算使用 Bigquery 将包含空列数的 table 显示为所有三个 table。 构造 null table
的架构student_name_null_pct float,
student_address_null int,
student_address_null_pct float,
student_mark_null int,
Staff_name_null int,
Staff_address_null int,
staff_class_null int,
alumni_name_null int,
alumni_address_null int,
alumni_year_passing_null int
在 bigquery 中使用了结构
SELECT
( (
SELECT
AS STRUCT student_name_null,
ROUND(SAFE_DIVIDE(student_name_null,
total_rows), 5) AS student_name_null_pct,
student_address,
ROUND(SAFE_DIVIDE(student_address,
total_rows), 5) AS student_address_pct
FROM (
SELECT
CURRENT_DATE() AS date,
COUNT(*) AS total_rows,
COUNTIF(student.student_name IS NULL) AS student_name_null,
COUNTIF(distributors.student_address IS NULL) AS student_address,
COUNTIF(distributors.student_mark IS NULL) AS student_mark
FROM
`school.student_table` AS student)),
(
SELECT
AS STRUCT total_rows_staff,
Staff_name,
ROUND(SAFE_DIVIDE(Staff_name,
total_rows_staff), 5) AS Staff_name_pct,
brand_title,
ROUND(SAFE_DIVIDE(Staff_address,
total_rows_staff), 5) AS Staff_address_pct
FROM (
SELECT
COUNT(*) AS total_rows_staff,
COUNTIF(products.Staff_name IS NULL) AS Staff_name,
COUNTIF(products.Staff_address IS NULL) AS Staff_address,
FROM
`school.staff_table` AS staff))
在结构中获取结果不能用于我排除的模式。请帮助我解决问题。
SELECT
CURRENTDATE() AS date,
student_name_null,
ROUND(SAFE_DIVIDE(student_name_null,
total_rows), 5) AS student_name_null_pct,
student_address,....
FROM (
SELECT
COUNT(*) AS total_rows,
COUNTIF(student.student_name IS NULL) AS student_name_null,
COUNTIF(distributors.student_address IS NULL) AS student_address,
COUNTIF(distributors.student_mark IS NULL) AS student_mark
FROM
`school.student_table` AS student),
(
SELECT
COUNT(*) AS total_rows_staff,
COUNTIF(products.Staff_name IS NULL) AS Staff_name,
COUNTIF(products.Staff_address IS NULL) AS Staff_address,
FROM
`school.staff_table` AS staff))
这解决了我的问题