Coupon - User

The CouponUser table is designed to store the relationship between coupons and users. Each record represents a user who has claimed a coupon.

Table Structure
  • [ID] (bigint, auto-incrementing, primary key): Represents the unique identifier for each record.

  • [Coupon_ID] (bigint, not null): Represents the ID of the coupon that the user has claimed.

  • [User_ID] (bigint, not null): Represents the ID of the user who has claimed the coupon.

  • [Modified_By] (bigint, nullable): Represents the ID of the user who last modified the record.

  • [Modified_Date] (datetime, not null): Represents the date and time when the record was last modified.

  • [Created_By] (bigint, nullable): Represents the ID of the user who created the record.

  • [Created_Date] (datetime, not null): Represents the date and time when the record was created.

Constraints
  • [PK_CouponUser]: Primary key constraint on the [ID] column.

  • [DF_CouponUser_ModifiedDate]: Default constraint to set the [Modified_Date] column to the current UTC date and time.

  • [DF_CouponUser_CreatedDate]: Default constraint to set the [Created_Date] column to the current UTC date and time.

  • [FK_CouponUser_Coupon]: Foreign key constraint referencing the [ID] column of the [JFW].[Coupon] table.

  • [FK_CouponUser_User]: Foreign key constraint referencing the [ID] column of the [JFW].[User] table.

Usage

The usage of the `CouponUser` table includes, but is not limited to, the following: - Counting the number of users who have claimed a coupon. - Retrieving the remaining number of coupons available to claim. - Tracking the users who have claimed a coupon.

Last updated

Was this helpful?