Avant de pouvoir explorer BigQuery, vous devez vous connecter à la consoleGoogle Cloud et créer un projet. Si vous n'activez pas la facturation dans votre projet, toutes les données que vous importez sont placées dans le bac à sable BigQuery.
Vous pouvez ainsi apprendre à utiliser BigQuery sans frais, mais en n'utilisant qu'un ensemble limité de fonctionnalités BigQuery. Pour en savoir plus, consultez Activer le bac à sable BigQuery.
Sign in to your Google Cloud account. If you're new to
Google Cloud,
create an account to evaluate how our products perform in
real-world scenarios. New customers also get $300 in free credits to
run, test, and deploy workloads.
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
Facultatif : Si vous sélectionnez un projet existant, veillez à activer l'API BigQuery. L'API BigQuery est automatiquement activée dans les nouveaux projets.
Créer un ensemble de données BigQuery
Vous pouvez créer un ensemble de données permettant de stocker les données à l'aide de la console Google Cloud . Vous créez votre ensemble de données dans l'emplacement multirégional US. Pour en savoir plus sur les régions et les emplacements multirégionaux BigQuery, consultez Emplacements.
Dans la console Google Cloud , ouvrez la page "BigQuery".
Dans le volet Explorateur, cliquez sur le nom de votre projet.
Cliquez sur more_vertAfficher les actions.
Sélectionnez Create Dataset (Créer un ensemble de données).
Sur la page Créer un ensemble de données, procédez comme suit :
Dans le champ ID de l'ensemble de données, saisissez babynames.
Pour Type d'emplacement, sélectionnez Multirégional, puis choisissez US (plusieurs régions aux États-Unis). Les ensembles de données publics sont stockés dans l'emplacement multirégional us. Par souci de simplicité, stockez votre ensemble de données dans le même emplacement.
Conservez les autres paramètres par défaut, puis cliquez sur Créer un ensemble de données.
Télécharger le fichier contenant les données sources
Le fichier que vous téléchargez contient environ 7 Mo de données correspondant aux prénoms populaires donnés aux bébés. Il provient de l'Administration de la sécurité sociale des États-Unis.
Téléchargez les données de l'Administration de la sécurité sociale des États-Unis en ouvrant l'URL suivante dans un nouvel onglet du navigateur :
https://www.ssa.gov/OACT/babynames/names.zip
Extrayez le fichier.
Pour en savoir plus sur le schéma de l'ensemble de données, consultez le fichier NationalReadMe.pdf du fichier ZIP.
Pour voir à quoi ressemblent les données, ouvrez le fichier yob2024.txt. Ce fichier contient des valeurs séparées par une virgule spécifiant le prénom, le genre attribué à la naissance et le nombre d'enfants portant ce prénom. Le fichier ne comporte pas de ligne d'en-tête.
Notez l'emplacement du fichier yob2024.txt pour pouvoir le retrouver ultérieurement.
Charger des données dans une table
Ensuite, chargez les données dans une table.
Dans le volet Explorateur, développez le nom de votre projet.
À côté de l'ensemble de données babynames, cliquez sur more_vertAfficher les actions, puis sélectionnez Ouvrir.
Cliquez sur add_boxCréer une table.
Sauf indication contraire, utilisez les valeurs par défaut pour tous les paramètres.
Sur la page Créer une table, procédez comme suit :
Dans la section Source, sous Créer une table à partir de, sélectionnez Importer dans la liste.
Dans le champ Sélectionner un fichier, cliquez sur Parcourir.
Accédez à votre fichier yob2024.txt local et sélectionnez-le, puis cliquez sur Ouvrir.
Dans la liste Format de fichier, sélectionnez CSV.
Dans la section Destination, saisissez names_2024 dans le champ Table.
Dans la section Schéma, cliquez sur le bouton Modifier sous forme de texte et collez la définition de schéma suivante dans le champ de texte :
Attendez que BigQuery crée la table et charge les données.
Prévisualiser les données de la table
Pour prévisualiser les données de la table, procédez comme suit :
Dans le volet Explorateur, développez votre projet et votre ensemble de données babynames, puis sélectionnez la table names_2024.
Cliquez sur l'onglet Aperçu. BigQuery affiche les premières lignes de la table.
L'onglet Aperçu n'est pas disponible pour tous les types de table. Par exemple, l'onglet Aperçu n'est pas affiché pour les tables ou les vues externes.
Interroger les données de la table
Vous allez maintenant interroger la table.
À côté de l'onglet names_2024, cliquez sur l'option add_boxRequête SQL. Un nouvel onglet de l'éditeur s'ouvre.
Dans l'éditeur de requête, collez la requête suivante. Cette requête permet de récupérer les cinq premiers prénoms donnés aux bébés qui ont été désignés hommes à la naissance aux États-Unis en 2024.
Cliquez sur Exécuter.
Les résultats sont affichés dans la section Résultats de la requête.
Vous avez interrogé une table dans un ensemble de données public, puis chargé vos exemples de données dans BigQuery à l'aide de la console Google Cloud .
Effectuer un nettoyage
Pour éviter que les ressources utilisées dans cette démonstration soient facturées sur votre compte Google Cloud , procédez comme suit :
Dans la console Google Cloud , ouvrez la page "BigQuery".
Dans le volet Explorateur, cliquez sur l'ensemble de données babynames que vous avez créé.
Développez l'option more_vertAfficher les actions, puis cliquez sur Supprimer.
Dans la boîte de dialogue Supprimer l'ensemble de données, confirmez la commande de suppression en saisissant le mot delete avant de cliquer sur Supprimer.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/04 (UTC)."],[[["\u003cp\u003eThis guide demonstrates how to use the Google Cloud console to create a BigQuery dataset, using the "babynames" dataset as an example.\u003c/p\u003e\n"],["\u003cp\u003eYou will learn how to download a sample dataset from the US Social Security Administration, containing popular baby names, and then load it into a BigQuery table.\u003c/p\u003e\n"],["\u003cp\u003eThe process includes creating a table named "names_2014," defining its schema, and loading the downloaded CSV data into it.\u003c/p\u003e\n"],["\u003cp\u003eThe guide illustrates how to preview the data within the newly created table and subsequently run a query to retrieve the top five male baby names from the year 2014.\u003c/p\u003e\n"],["\u003cp\u003eInstructions are provided on how to clean up the resources created in the tutorial to avoid incurring additional charges.\u003c/p\u003e\n"]]],[],null,["# Load and query data in BigQuery Studio\n======================================\n\nGet started with BigQuery by using BigQuery Studio to create a\ndataset, load data into a table, and query the table.\n\n*** ** * ** ***\n\nTo follow step-by-step guidance for this task directly in the\nGoogle Cloud console, click **Guide me**:\n\n[Guide me](https://console.cloud.google.com/freetrial?redirectPath=/?walkthrough_id=bigquery--bigquery-quickstart-load-data-console)\n\n*** ** * ** ***\n\nBefore you begin\n----------------\n\nBefore you can explore BigQuery, you must sign in to Google Cloud console and create a project. If you don't enable billing in your project, then all of the data you upload will be in the BigQuery sandbox. The sandbox makes it possible for you to learn BigQuery at no charge while working with a limited set of BigQuery features. For more information, see [Enable the BigQuery sandbox](/bigquery/docs/sandbox).\n\n\u003cbr /\u003e\n\n- Sign in to your Google Cloud account. If you're new to Google Cloud, [create an account](https://console.cloud.google.com/freetrial) to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n\n\n Enable the BigQuery API.\n\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=bigquery)\n\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n\n\n Enable the BigQuery API.\n\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=bigquery)\n\n1. Optional: If you select an existing project, make sure that you [enable\n the BigQuery API](https://console.cloud.google.com/flows/enableapi?apiid=bigquery). The BigQuery API is automatically enabled in new projects.\n\nCreate a BigQuery dataset\n-------------------------\n\nUse the Google Cloud console to create a dataset to store the data. You\ncreate your dataset in the US multi-region location. For information on\nBigQuery regions and multi-regions, see\n[Locations](/bigquery/docs/dataset-locations).\n\n1. In the Google Cloud console, open the BigQuery Studio page.\n[Go to BigQuery Studio](https://console.cloud.google.com/bigquery)\n2. In the **Explorer** pane, click your project name.\n3. Click more_vert **View actions**.\n4. Select **Create dataset**.\n5. On the **Create dataset** page, do the following:\n 1. For **Dataset ID** , enter `babynames`.\n 2. For **Location type** , select **Multi-region** , and then choose **US (multiple regions in United States)** . The public datasets are stored in the `us` multi-region location. For simplicity, store your dataset in the same location.\n 3. Leave the remaining default settings as they are, and click **Create dataset**.\n\nDownload the file that contains the source data\n-----------------------------------------------\n\nThe file that you're downloading contains approximately 7 MB of data about popular baby names. It's provided by the US Social Security Administration.\n\n\u003cbr /\u003e\n\nFor more information about the data, see the Social Security Administration's\n[Background information for popular names](http://www.ssa.gov/OACT/babynames/background.html).\n\n1. Download the US Social Security Administration's data by opening the\n following URL in a new browser tab:\n\n https://www.ssa.gov/OACT/babynames/names.zip\n\n2. Extract the file.\n\n For more information about the dataset schema, see the zip file's\n `NationalReadMe.pdf` file.\n3. To see what the data looks like, open the `yob2024.txt` file. This file\n contains comma-separated values for name, assigned sex at birth, and number\n of children with that name. The file has no header row.\n\n4. Note the location of the `yob2024.txt` file so that you can find it later.\n\nLoad data into a table\n----------------------\n\nNext, load the data into a new table.\n\n1. In the **Explorer** pane, expand your project name.\n2. Next to the **babynames** dataset, click more_vert **View\n actions** and select **Open**.\n3. Click add_box **Create\n table** .\n\n Unless otherwise indicated, use the default values for all settings.\n4. On the **Create table** page, do the following:\n 1. In the **Source** section, for **Create table\n from**, choose **Upload** from the list.\n 2. In the **Select file** field, click **Browse**.\n 3. Navigate to and open your local `yob2024.txt` file, and click **Open**.\n 4. From the **File\n format** list, choose **CSV**.\n 5. In the **Destination** section, in the **Table** field, enter `names_2024`.\n 6. In the **Schema** section, click the **Edit\n as text** toggle, and paste the following schema definition into the text field: \n\n name:string,assigned_sex_at_birth:string,count:integer\n\n 7. Click **Create\n table**.\n\n Wait for BigQuery to create the table and load the data.\n\nPreview table data\n------------------\n\nTo preview the table data, follow these steps:\n\n1. In the **Explorer** pane, expand your project and `babynames` dataset, and then select the `names_2024` table.\n2. Click the **Preview** tab. BigQuery displays the first few rows of the table.\n\nThe **Preview** tab is not available for all table types. For example, the **Preview** tab is not displayed for external tables or views.\n\nQuery table data\n----------------\n\nNext, query the table.\n\n1. Next to the **names_2024** tab, click the add_box **SQL query** option. A new editor tab opens.\n2. In the query editor, paste the following query. This query retrieves the top five names for babies born in the US that were assigned male at birth in 2024. \n\n\n SELECT\n name,\n count\n FROM\n `babynames.names_2024`\n WHERE\n assigned_sex_at_birth = 'M'\n ORDER BY\n count DESC\n LIMIT\n 5;\n \n3. Click **Run**. The results are displayed in the **Query results** section. \n\nYou have successfully queried a table in a public dataset and then loaded your\nsample data into BigQuery using the Google Cloud console.\n\nClean up\n--------\n\n\nTo avoid incurring charges to your Google Cloud account for\nthe resources used on this page, follow these steps.\n\n1. In the Google Cloud console, open the BigQuery page.\n[Go to BigQuery](https://console.cloud.google.com/bigquery)\n2. In the **Explorer** pane, click the `babynames` dataset that you created.\n3. Expand the more_vert **View actions** option and click **Delete**.\n4. In the **Delete dataset** dialog, confirm the delete command: type the word `delete` and then click **Delete**.\n\nWhat's next\n-----------\n\n- To learn more about loading data into BigQuery, see [Introduction to loading data](/bigquery/docs/loading-data).\n- To learn more about querying data, see [Overview of BigQuery analytics](/bigquery/docs/query-overview).\n- To learn how to load a JSON file with nested and repeated data, see [Loading nested and repeated JSON data](/bigquery/docs/loading-data-cloud-storage-json#loading_nested_and_repeated_json_data).\n- To learn more about accessing BigQuery programmatically, see the [REST API](/bigquery/docs/reference/rest/v2) reference or the [BigQuery client libraries](/bigquery/docs/reference/libraries) page."]]