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

  • Home
  • SEARCH
  • 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 6653983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:20:08+00:00 2026-05-26T01:20:08+00:00

user_drug.user_id is constrained by Foreign Key drug.id (which is a Primary Key). Table structure

  • 0

user_drug.user_id is constrained by Foreign Key drug.id (which is a Primary Key).

Table structure is as follows:

user
id    name  income
1     Foo   10000
2     Bar   20000
3     Baz   30000

drug
id    name
0     Marijuana
1     Cocaine
2     Heroin

user_drug
user_id drug_id
1       1
1       2
2       1       
2       3
3       3

Are there any drawbacks to starting drug.id at 0? I have a feeling that that will make things more natural with PHP since arrays also start at 0, but I want to make sure there aren’t any drawbacks with using ‘0’ for an id (e.g. it might be interpreted as null or some other strange potential occurrence/conflict).

  • 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-26T01:20:08+00:00Added an answer on May 26, 2026 at 1:20 am

    If its an AUTO INCREMENT col, zero is a special value which shouldnt be used, but this can be overcome. If its a foreign key and non AUTO INCREMENT, any value is OK. Zero will not be interpreted as anything other than a zero if your column definition is correct (null values appear as NULL, which is distinct from zero)

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

Sidebar

Related Questions

//user: id name password how to properly make friends system? how should look table
... user_id INTEGER NOT NULL, CONSTRAINT fk_user_meta FOREIGN KEY (user_id) REFERENCES users (id) ON
user table user_id entry user_id points_a points_b SELECT user.*, (SUM(entry.points_a) + SUM(entry.points_b)) as points_total
User scenario is like follows. My application has list of companies. Each company has
User goes to a page which has a SELECT choice list. Once he picks
User table contains the following attributes (dateOfBirth, race, gender, ...). We would like to
user signs up for a key and secret from my site, then they can
User inserts new records in the table in his browser with no postback (using
User Class - Name - Picture Friend Class - Profile Of Type User -
User of my site upload images which are used as avatars. I have set

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.