El contenido no se encuentra disponible en el idioma seleccionado. Estamos trabajando continuamente para agregar más idiomas. Gracias por su apoyo.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Gray Upgrade

Updated on 2025-02-17 GMT+08:00

Scenarios

You can use gray upgrade to upgrade your GaussDB instance if a version upgrade is required for new functions or issue rectification. You can either select auto-commit after the upgrade or perform a rolling upgrade.

  • In the auto-commit mode, all standby DNs are upgraded first and then primary DNs and CNs in sequence. After the upgrade is complete, the upgrade is automatically committed.
  • The rolling upgrade mode is also known as the upgrade observation mode. In this mode, the system enters the observation state after the upgrade is complete. During this period, you can observe the service status and either commit or roll back the upgrade based on service status.

Operation Process

Step

Description

Step 1: Perform a Pre-upgrade Check

Before an upgrade, check the instance status and whether monitoring metrics such as the CPU usage, memory usage, and disk usage of the instance are normal.

Step 2: Perform the Upgrade

Select either auto-commit after the upgrade or perform a rolling upgrade. You can upgrade a single instance or multiple instances in batches as required.

Step 3: Verify the Upgrade

After the upgrade is complete, check the instance status, backup creation status, and instance connectivity, and whether you can add, delete, update, and query data in the instance.

Precautions

  • The DN disk usage cannot be greater than the configured disk usage threshold minus 10%.
    NOTE:

    To check the current DN disk usage, go to the metric monitoring page on the management console.

    To obtain the disk usage threshold, contact technical support.

  • Version upgrade is unavailable if instance nodes are in an abnormal state.
  • The rolling upgrade mode supports manual rollback, but the auto-commit mode does not support manual rollback.
  • During an upgrade or rollback, the following operations cannot be performed: scaling up storage, changing specifications, backing up data, resetting passwords, rebooting instances, and deleting instances.
  • You are advised to perform an upgrade during off-peak hours because there are more idle CPU, disk, and memory resources.
  • If upgrade auto-commit is used for a major version upgrade, log archiving will be disabled before the upgrade, and you cannot use archive logs for PITR, which may result in data loss.
  • If rolling upgrade is used for a major version upgrade, full backup cannot be triggered during the upgrade, and differential backup may fail. Manual full backups cannot be created until the upgrade operations in all AZs are complete during the rolling upgrade and observation period. Archive logs are still generated before the upgrade is committed, and you can use archive logs for PITR to prevent data loss. In the upgrade commit phase, log archiving is disabled.
  • If the upgrade fails, the system automatically rolls back the instance to the source version. You can contact Huawei Cloud technical support, and Huawei Cloud engineers will help you upgrade the instance if necessary.
  • Services are interrupted for about 10 seconds during the upgrade of primary DNs and during the upgrade of CNs.
  • After the upgrade is complete, an automated backup task will be triggered and log archiving will be enabled. However, an automated backup task will not be triggered in the case of minor version upgrades.
    NOTICE:

    Log archiving is available only for instances of versions later than V2.0-2.2.

    Example minor version upgrade: from V2.0-1.a.x to V2.0-1.a.y or from V2.0-2.a.x to V2.0-2.a.y

    Example major version upgrade: from V2.0-1.x to V2.0-2.x or from V2.0-2.x to V2.0-2.y

Step 1: Perform a Pre-upgrade Check

Before an upgrade, check the instance status and whether monitoring metrics such as the CPU usage, memory usage, and disk usage of the instance are normal.

  1. Check instance status.
    1. Log in to the management console.
    2. Click in the upper left corner and select a region and project.
    3. Click in the upper left corner of the page and choose Databases > GaussDB.
    4. On the Instances page, check whether the target instance is available.
      Figure 1 Instance status

      If the instance is in an abnormal state, contact Huawei Cloud technical support.

  2. Check monitoring metrics.
    1. Click in the upper left corner of the page, and choose Management & Governance > Cloud Eye.
    2. In the navigation pane, choose Cloud Service Monitoring > GaussDB.
    3. On the Cloud Service Monitoring page, click the target instance to go to the metric monitoring page.
      • On the DB Instance tab, view the value of Instance Disk Usage to check whether the disk usage is insufficient.
      • On the Node tab, view the value of CPU Usage to check whether the CPU usage remains high for a long time.
      • On the Node tab, view the value of Memory Usage to check whether the memory usage increases sharply.

      If any of the metrics are abnormal, contact Huawei Cloud technical support.

Step 2: Perform the Upgrade

You can select auto-commit after the upgrade or perform a rolling upgrade for gray upgrade as required.

[Method 1: upgrading a single instance]

  1. Click in the upper left corner of the page and choose Databases > GaussDB.
  2. On the Instances page, click More in the Operation column of the target instance and choose Upgrade.
  3. In the Upgrade Instance dialog box, select Gray upgrade for Upgrade Method.
  4. Select Auto-commit for Action.

    Figure 2 Upgrading an instance

  5. Select the target version, enter YES, and click OK.
  6. Check the upgrade result on the Instances page.
    • During the upgrade, the instance status is Upgrading version.
    • After the upgrade is complete, the instance status changes to Available.
[Method 2: upgrading instances in batches]
  1. Click in the upper left corner of the page and choose Databases > GaussDB.
  2. On the Instances page, select the target instances and click Batch Upgrade.
    Figure 3 Batch upgrade

  3. In the Batch Upgrade dialog box, select Gray upgrade for Upgrade Method.
  4. Select Auto-commit for Action.
  5. Select the target version, enter YES, and click OK.
    Figure 4 Auto-commit of a gray upgrade

  6. Check the upgrade result on the Instances page.
    • During the upgrade, the instance status is Upgrading version.
    • After the upgrade is complete, the instance status changes to Available.

[Method 1: upgrading a single instance]

  • Upgrading a distributed instance
    1. Click in the upper left corner of the page and choose Databases > GaussDB.
    2. On the Instances page, click More in the Operation column of the target instance and choose Upgrade.

      Alternatively, click the target instance name to go to the Basic Information page. In the Configuration area, click Upgrade Instance in the DB Engine Version field.

      Figure 5 Basic information
    3. In the Upgrade Instance dialog box, select Gray upgrade for Upgrade Method.
    4. Select Rolling upgrade for Action.
    5. Set Shards to Upgrade, select a target version, enter YES, and click OK.

    6. Check the upgrade result on the Instances page.
      1. During the upgrade, the instance status is Upgrading version.
      2. After the upgrade is complete, the instance status changes to Observing version upgrade.
    7. Check that all shards are upgraded and services are running properly before committing the upgrade.

      In the Upgrade Instance dialog box, select Commit for Action, select a target version, enter YES, and click OK.

      NOTICE:

      If you choose to upgrade shards one by one, repeat 2 to 6 until all shards are upgraded, and then commit the upgrade.

  • Upgrading a centralized instance
    1. Click in the upper left corner of the page and choose Databases > GaussDB.
    2. On the Instances page, click More in the Operation column of the target instance and choose Upgrade.

      Alternatively, click the target instance name to go to the Basic Information page. In the Configuration area, click Upgrade Instance in the DB Engine Version field.

      Figure 6 Basic information
    3. In the Upgrade Instance dialog box, select Gray upgrade for Upgrade Method.
    4. Select Rolling upgrade for Action.
    5. Set AZs to Upgrade, select a target version, enter YES, and click OK.

      NOTE:

      You can upgrade a single AZ or multiple AZs at a time as needed.

    6. Check the upgrade result on the Instances page.
      1. During the upgrade, the instance status is Upgrading version.
      2. After the upgrade is complete, the instance status changes to Observing version upgrade.
    7. Check that all AZs are upgraded and services are running properly before committing the upgrade.

      In the Upgrade Instance dialog box, select Commit for Action, select a target version, enter YES, and click OK.

      NOTICE:

      If you choose to upgrade AZs one by one, repeat 2 to 6 until all AZs are upgraded, and then commit the upgrade.

[Method 2: upgrading instances in batches]
  1. Click in the upper left corner of the page and choose Databases > GaussDB.
  2. On the Instances page, select the target instances and click Batch Upgrade.
    Figure 7 Batch upgrade

  3. In the Batch Upgrade dialog box, select Gray upgrade for Upgrade Method.
  4. Select Rolling upgrade for Action.
  5. Select the target version, enter YES, and click OK.
    Figure 8 Rolling upgrade of a gray upgrade

    NOTE:

    During a batch upgrade in rolling upgrade mode, all AZs or shards of the selected instances are upgraded by default.

  6. Check the upgrade result on the Instances page.
    • During the upgrade, the instance status is Upgrading version.
    • After the upgrade is complete, the instance status changes to Observing version upgrade.
  7. Check that all shards or AZs are upgraded and services are running properly before committing the upgrade.

    In the Batch Upgrade dialog box, select Commit for Action, select a target version, enter YES, and click OK.

[Method 1: upgrading a single instance]

  1. Click in the upper left corner of the page and choose Databases > GaussDB.
  2. On the Instances page, click More in the Operation column of the target instance and choose Upgrade.
  3. In the Upgrade Instance dialog box, select Gray upgrade for Upgrade Method.
  4. Select Auto-commit for Action.

    Figure 2 Upgrading an instance

  5. Select the target version, enter YES, and click OK.
  6. Check the upgrade result on the Instances page.
    • During the upgrade, the instance status is Upgrading version.
    • After the upgrade is complete, the instance status changes to Available.
[Method 2: upgrading instances in batches]
  1. Click in the upper left corner of the page and choose Databases > GaussDB.
  2. On the Instances page, select the target instances and click Batch Upgrade.
    Figure 3 Batch upgrade

  3. In the Batch Upgrade dialog box, select Gray upgrade for Upgrade Method.
  4. Select Auto-commit for Action.
  5. Select the target version, enter YES, and click OK.
    Figure 4 Auto-commit of a gray upgrade

  6. Check the upgrade result on the Instances page.
    • During the upgrade, the instance status is Upgrading version.
    • After the upgrade is complete, the instance status changes to Available.

[Method 1: upgrading a single instance]

  • Upgrading a distributed instance
    1. Click in the upper left corner of the page and choose Databases > GaussDB.
    2. On the Instances page, click More in the Operation column of the target instance and choose Upgrade.

      Alternatively, click the target instance name to go to the Basic Information page. In the Configuration area, click Upgrade Instance in the DB Engine Version field.

      Figure 5 Basic information
    3. In the Upgrade Instance dialog box, select Gray upgrade for Upgrade Method.
    4. Select Rolling upgrade for Action.
    5. Set Shards to Upgrade, select a target version, enter YES, and click OK.

    6. Check the upgrade result on the Instances page.
      1. During the upgrade, the instance status is Upgrading version.
      2. After the upgrade is complete, the instance status changes to Observing version upgrade.
    7. Check that all shards are upgraded and services are running properly before committing the upgrade.

      In the Upgrade Instance dialog box, select Commit for Action, select a target version, enter YES, and click OK.

      NOTICE:

      If you choose to upgrade shards one by one, repeat 2 to 6 until all shards are upgraded, and then commit the upgrade.

  • Upgrading a centralized instance
    1. Click in the upper left corner of the page and choose Databases > GaussDB.
    2. On the Instances page, click More in the Operation column of the target instance and choose Upgrade.

      Alternatively, click the target instance name to go to the Basic Information page. In the Configuration area, click Upgrade Instance in the DB Engine Version field.

      Figure 6 Basic information
    3. In the Upgrade Instance dialog box, select Gray upgrade for Upgrade Method.
    4. Select Rolling upgrade for Action.
    5. Set AZs to Upgrade, select a target version, enter YES, and click OK.

      NOTE:

      You can upgrade a single AZ or multiple AZs at a time as needed.

    6. Check the upgrade result on the Instances page.
      1. During the upgrade, the instance status is Upgrading version.
      2. After the upgrade is complete, the instance status changes to Observing version upgrade.
    7. Check that all AZs are upgraded and services are running properly before committing the upgrade.

      In the Upgrade Instance dialog box, select Commit for Action, select a target version, enter YES, and click OK.

      NOTICE:

      If you choose to upgrade AZs one by one, repeat 2 to 6 until all AZs are upgraded, and then commit the upgrade.

[Method 2: upgrading instances in batches]
  1. Click in the upper left corner of the page and choose Databases > GaussDB.
  2. On the Instances page, select the target instances and click Batch Upgrade.
    Figure 7 Batch upgrade

  3. In the Batch Upgrade dialog box, select Gray upgrade for Upgrade Method.
  4. Select Rolling upgrade for Action.
  5. Select the target version, enter YES, and click OK.
    Figure 8 Rolling upgrade of a gray upgrade

    NOTE:

    During a batch upgrade in rolling upgrade mode, all AZs or shards of the selected instances are upgraded by default.

  6. Check the upgrade result on the Instances page.
    • During the upgrade, the instance status is Upgrading version.
    • After the upgrade is complete, the instance status changes to Observing version upgrade.
  7. Check that all shards or AZs are upgraded and services are running properly before committing the upgrade.

    In the Batch Upgrade dialog box, select Commit for Action, select a target version, enter YES, and click OK.

Step 3: Verify the Upgrade

After the upgrade is complete, check the instance status, backup creation status, and instance connectivity, and whether you can add, delete, update, and query data in the instance.

  1. On the Instances page, check whether Status of the target instance is Available.
  2. On the Instances page, click the name of the target instance. On the Basic Information page that is displayed, check whether the value of DB Engine Version in the Configuration area is the target version.
  3. Check that the automated backup triggered after the upgrade is successfully created.
    1. On the Instances page, click the name of the target instance to go to the Basic Information page.
    2. In the navigation pane, choose Backups. Check that a backup has been created and the backup status is Completed.
  4. Check that the instance is properly connected and you can add, delete, update, and query data in the instance.
    1. Log in to the database. For details, see Connecting to an Instance Through DAS.
    2. Go to the SQL Query page.
      Figure 9 SQL query
    3. Create a database.

      CREATE DATABASE database_name;

      In this example, run the following command to create a database named db_tpcds:

      CREATE DATABASE db_tpcds;

      Switch to the newly created database in the upper left corner.

      Figure 10 Switching to the new database
    4. Create a table and add, delete, update, and query data in the table.
      1. Create a schema.

        CREATE SCHEMA myschema;

      2. Create a table named mytable that has only one column. The column name is firstcol and the column type is integer.

        CREATE TABLE myschema.mytable (firstcol int);

      3. Insert data into the table.

        INSERT INTO myschema.mytable VALUES (100);

      4. View the data in the table.

        SELECT * FROM myschema.mytable;

           | firstcol | 
        ---+----------+
        1  |   100    |
      5. Update data in the table.

        UPDATE myschema.mytable SET firstcol = 200;

      6. View the data in the table again.

        SELECT * FROM myschema.mytable;

           | firstcol | 
        ---+----------+
        1  |   200    |
      7. Drop the table.

        DROP TABLE myschema.mytable;

Rollback Operations

During upgrade observation, if a rollback is required due to service reasons or the upgrade using the rolling upgrade mode fails, you can manually roll back the upgrade by performing the steps in this section.

NOTE:
  • If the rollback is successful, you can perform the upgrade again.
  • If the rollback fails, you can perform the rollback again.

If the problem persists, contact Huawei Cloud technical support, and Huawei Cloud engineers will help you upgrade the instance if necessary.

  1. In the Upgrade Instance dialog box, select Rollback for Action, select a target version, enter YES, and click OK.
  2. On the Instances page, check the rollback status. After the rollback is complete, the instance status changes to Available.
  3. On the Instances page, click the name of the target instance. On the Basic Information page that is displayed, check that the value of DB Engine Version in the Configuration area is the source version, that is, the version before upgrade.
  4. Check that the instance is properly connected and you can add, delete, update, and query data in the instance.

    1. Log in to the database. For details, see Connecting to an Instance Through DAS.
    2. Go to the SQL Query page.
      Figure 11 SQL query
    3. Create a database.

      CREATE DATABASE database_name;

      In this example, run the following command to create a database named db_tpcds:

      CREATE DATABASE db_tpcds;

      Switch to the newly created database in the upper left corner.

      Figure 12 Switching to the new database
    4. Create a table and add, delete, update, and query data in the table.
      1. Create a schema.

        CREATE SCHEMA myschema;

      2. Create a table named mytable that has only one column. The column name is firstcol and the column type is integer.

        CREATE TABLE myschema.mytable (firstcol int);

      3. Insert data into the table.

        INSERT INTO myschema.mytable values (100);

      4. View data in the table.

        SELECT * FROM myschema.mytable;

           | firstcol | 
        ---+----------+
        1  |   100    |
      5. Update data in the table.

        UPDATE myschema.mytable SET firstcol = 200;

      6. View the data in the table again.

        SELECT * FROM myschema.mytable;

           | firstcol | 
        ---+----------+
        1  |   200    |
      7. Drop the table.

        DROP TABLE myschema.mytable;

  1. On the Instances page, select the target instances and click Batch Upgrade.
  2. In the Batch Upgrade dialog box, select Rollback for Action, select a target version, enter YES, and click OK.

  3. On the Instances page, check the rollback status. After the rollback is complete, the instance status changes to Available.
  4. On the Instances page, click the name of the target instance. On the Basic Information page that is displayed, check that the value of DB Engine Version in the Configuration area is the source version, that is, the version before upgrade.
  5. Check that the instance is properly connected and you can add, delete, update, and query data in the instance.

    1. Log in to the database. For details, see Connecting to an Instance Through DAS.
    2. Go to the SQL Query page.
      Figure 13 SQL query
    3. Create a database.

      CREATE DATABASE database_name;

      In this example, run the following command to create a database named db_tpcds:

      CREATE DATABASE db_tpcds;

      Switch to the newly created database in the upper left corner.

      Figure 14 Switching to the new database
    4. Create a table and add, delete, update, and query data in the table.
      1. Create a schema.

        CREATE SCHEMA myschema;

      2. Create a table named mytable that has only one column. The column name is firstcol and the column type is integer.

        CREATE TABLE myschema.mytable (firstcol int);

      3. Insert data into the table.

        INSERT INTO myschema.mytable values (100);

      4. View data in the table.

        SELECT * FROM myschema.mytable;

           | firstcol | 
        ---+----------+
        1  |   100    |
      5. Update data in the table.

        UPDATE myschema.mytable SET firstcol = 200;

      6. View the data in the table again.

        SELECT * FROM myschema.mytable;

           | firstcol | 
        ---+----------+
        1  |   200    |
      7. Drop the table.

        DROP TABLE myschema.mytable;

  1. In the Upgrade Instance dialog box, select Rollback for Action, select a target version, enter YES, and click OK.
  2. On the Instances page, check the rollback status. After the rollback is complete, the instance status changes to Available.
  3. On the Instances page, click the name of the target instance. On the Basic Information page that is displayed, check that the value of DB Engine Version in the Configuration area is the source version, that is, the version before upgrade.
  4. Check that the instance is properly connected and you can add, delete, update, and query data in the instance.

    1. Log in to the database. For details, see Connecting to an Instance Through DAS.
    2. Go to the SQL Query page.
      Figure 11 SQL query
    3. Create a database.

      CREATE DATABASE database_name;

      In this example, run the following command to create a database named db_tpcds:

      CREATE DATABASE db_tpcds;

      Switch to the newly created database in the upper left corner.

      Figure 12 Switching to the new database
    4. Create a table and add, delete, update, and query data in the table.
      1. Create a schema.

        CREATE SCHEMA myschema;

      2. Create a table named mytable that has only one column. The column name is firstcol and the column type is integer.

        CREATE TABLE myschema.mytable (firstcol int);

      3. Insert data into the table.

        INSERT INTO myschema.mytable values (100);

      4. View data in the table.

        SELECT * FROM myschema.mytable;

           | firstcol | 
        ---+----------+
        1  |   100    |
      5. Update data in the table.

        UPDATE myschema.mytable SET firstcol = 200;

      6. View the data in the table again.

        SELECT * FROM myschema.mytable;

           | firstcol | 
        ---+----------+
        1  |   200    |
      7. Drop the table.

        DROP TABLE myschema.mytable;

  1. On the Instances page, select the target instances and click Batch Upgrade.
  2. In the Batch Upgrade dialog box, select Rollback for Action, select a target version, enter YES, and click OK.

  3. On the Instances page, check the rollback status. After the rollback is complete, the instance status changes to Available.
  4. On the Instances page, click the name of the target instance. On the Basic Information page that is displayed, check that the value of DB Engine Version in the Configuration area is the source version, that is, the version before upgrade.
  5. Check that the instance is properly connected and you can add, delete, update, and query data in the instance.

    1. Log in to the database. For details, see Connecting to an Instance Through DAS.
    2. Go to the SQL Query page.
      Figure 13 SQL query
    3. Create a database.

      CREATE DATABASE database_name;

      In this example, run the following command to create a database named db_tpcds:

      CREATE DATABASE db_tpcds;

      Switch to the newly created database in the upper left corner.

      Figure 14 Switching to the new database
    4. Create a table and add, delete, update, and query data in the table.
      1. Create a schema.

        CREATE SCHEMA myschema;

      2. Create a table named mytable that has only one column. The column name is firstcol and the column type is integer.

        CREATE TABLE myschema.mytable (firstcol int);

      3. Insert data into the table.

        INSERT INTO myschema.mytable values (100);

      4. View data in the table.

        SELECT * FROM myschema.mytable;

           | firstcol | 
        ---+----------+
        1  |   100    |
      5. Update data in the table.

        UPDATE myschema.mytable SET firstcol = 200;

      6. View the data in the table again.

        SELECT * FROM myschema.mytable;

           | firstcol | 
        ---+----------+
        1  |   200    |
      7. Drop the table.

        DROP TABLE myschema.mytable;

Utilizamos cookies para mejorar nuestro sitio y tu experiencia. Al continuar navegando en nuestro sitio, tú aceptas nuestra política de cookies. Descubre más

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback