Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6969923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:38:37+00:00 2026-05-27T16:38:37+00:00

I have a two tables events and bookings, which are linked by event_id. Example:

  • 0

I have a two tables events and bookings, which are linked by event_id.
Example:

CREATE TABLE `bookings` (

    `booking_id`  int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
    `event_id`  int(10) UNSIGNED NULL DEFAULT NULL,
    `fullname`  varchar(80) NOT NULL,
    `phone`  varchar(20) NULL DEFAULT NULL,
    `note`  text NULL,
    `date_created`  datetime NOT NULL,
    `date_updated`  timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,

    PRIMARY KEY (`booking_id`),
    FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE SET NULL ON UPDATE CASCADE,

    INDEX `event_id` USING BTREE (`event_id`),
    INDEX `source_id` USING BTREE (`source_id`) 
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
ROW_FORMAT=COMPACT;

    #events
CREATE TABLE `events` (
    `event_id`  int(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
    `date`  date NOT NULL ,
    `title`  varchar(255) NULL DEFAULT NULL ,
    `description`  text NULL,

    PRIMARY KEY (`event_id`, `date`),
    UNIQUE INDEX `date` USING BTREE (`date`) ,
    INDEX `event_id` USING BTREE (`event_id`) 
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
ROW_FORMAT=COMPACT;

I’m wondering, can I use date field as reference between tables, as it’s consume 1 byte less comparing to integer and it is easier to read and operate with single table rather than combined.
But I’m not sure how does it affect indexing and SQL query performance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:38:38+00:00Added an answer on May 27, 2026 at 4:38 pm

    It is not a good idea to use a pure data field as a link between tables. A date field appears to be a general purpose field intuitively, so another engineer would eventually update the field for sensible application purposes. If it were used as a table link, updates would break the linkage.

    Why not create a specific field for table linkage purposes? Sure, it might cost 4 or 8 bytes per record, but have you looked at the cost of storage? It is almost free. On the other hand, a non-intuitive use of a field might cost quite a bit in future errors, misunderstandings, confusion, and downtime.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables, events and photos, which relate together via the 'Event_ID' column.
I have got a problem with two tables: CREATE TABLE IF NOT EXISTS `addresses`
i have bookings table which has two people- i want to return person_1 as
I have two tables called 'events' and 'topics' each table can have many comments.
I have two tables: events : id, name, date_from, date_to event_recurrences : id, event_id,
I have two tables: events_archive and reports. The events table shows all information about
Lets say I have these two tables: CREATE TABLE nodes ( id INTEGER PRIMARY
I have a database with two tables, events and tickets . The events table
I have two tables, one called Events and one called Documents. Each table has
I have two tables: events and events_actions events columns: event_id user_id event_name events_actions columns:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.