In Google BigQuery, SQL is used to interact with datasets and retrieve data. One of the most basic and commonly used SQL statements is:
SELECT * FROM `project.dataset.table`;
This statement retrieves all columns and all rows from a specified table in BigQuery.
· SELECT * : This means "select all columns" from the table.
· FROM : This specifies the source table from which data will be retrieved.
· `project.dataset.table`: This refers to the fully qualified table name in BigQuery. It consists of:
o project: The Google Cloud project containing the dataset.
o dataset: A collection of related tables within the project.
o table: The actual table storing the data.
Imagine you have a table named sales_data inside a dataset called store_db in a project named retail_project. To fetch all data from this table, you would use:
SELECT * FROM `retail_project.store_db.sales_data`;
For example, when I enter the query:
SELECT * FROM `i-mariner-453509-e9.test_dataset.emps` LIMIT 2;
Before execution, the BigQuery Query Editor provides an estimate of the amount of data the query will process. For instance, it might display a message like:
"This query will process 573 B when run."
You can find this estimate in the top right corner of the query editor.
You can also format the
query for better readability by selecting MORE →
Format Query in the BigQuery Query Editor.
Previous Next Home
No comments:
Post a Comment