CommencerCommencez gratuitement

Creating a retail table

The business development team thinks there's an opportunity to increase revenue at each gym by adding a retail footprint. At this in-gym store, they'd sell things like towels, sneakers, and beverages. To track the goods being sold, they're going to need a new table in the CORE_GYM schema. To create this table, they've come to you. Show that what you've got!

Cet exercice fait partie du cours

<cours>Data Types and Functions in Snowflake</cours>
Voir le cours

Instructions de l’exercice

  • Create a transaction_id numeric field with a precision of 16 and scale of 0.
  • Define pre_tax_amount as a NUMBER that can have two digits right of the decimal point and a total of 6 digits.
  • Include a tax_rate column that could store a number such as 28.625; a total of 5 digits with 3 right of the decimal point.

Exercice interactif pratique

Essayez cet exercice en complétant ce code d’exemple.

CREATE OR REPLACE TABLE retail (
  	-- transaction_id stores 16 total digits with 0 right of the decimal point
    ___ NUMBER(16, 0),
  	-- pre_tax_amount stores up to 6 digits with 2 right of the decimal point
    ___,
  	-- tax_rate stores up to 5 digits with 3 right of the decimal point
    ___,
    transaction_total NUMBER(6, 2)
);
Modifier et exécuter le code