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!
This exercise is part of the course
Data Types and Functions in Snowflake
Exercise instructions
- Create a
transaction_id
numeric field with a precision of 16 and scale of 0. - Define
pre_tax_amount
as aNUMBER
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 as28.625
; a total of 5 digits with 3 right of the decimal point.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
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)
);