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 8187851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:42:10+00:00 2026-06-07T02:42:10+00:00

I have table as below personalInfo CREATE TABLE personalInfo(userid BIGINT AUTO_INCREMENT PRIMARY KEY) patentInfo

  • 0

I have table as below

personalInfo

CREATE TABLE personalInfo(userid BIGINT AUTO_INCREMENT PRIMARY KEY)

patentInfo

CREATE TABLE patentInfo 
(
 userid BIGINT,
 patentId BIGINT AUTO_INCREMENT,
 FOREIGN KEY (userid) REFERENCES personalInfo(userid), 
 PRIMARY KEY (userid,patentId)
)

While creating table patentInfo, I am getting error as

Incorrect table definition; there can be only one auto column and it must be defined as a key.

What I want to do is add patent for Users. So I was trying to use patentId as AUTO_INCREMENT and keep compiste primary key as combination of patentId & userid.

Any idea how can I get this done?

Update 1:

My AIM is, I don’t want to insert patentId in mysql query. mysql itself will create next number.

  • 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-06-07T02:42:12+00:00Added an answer on June 7, 2026 at 2:42 am

    Since patentId is AUTO_INCREMENT, then the it should be the primary key.

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

Sidebar

Related Questions

I have a table pictured below that has a surrogate Key as the Primary
I have a table as below dbo.UserLogs ------------------------------------- Id | UserId |Date | Name|
create table Machine ( Machine_ID int primary key, Machine_Name varchar(30) Machine_Title varchar(30) ) create
i have a table like below: create table info (username varchar(30),otherinfo varchar(100)); now i
assuming we have a table like below name | userid | score | datestamp
I have two table like below CREATE TABLE IF NOT EXISTS `countries` ( `id`
I have a table which have 4 fields. Col1 Guid Primary-Key (FK to another
I have table definition like below: Place (id, name) Review (id, userid, placeid) Favorite
i have the table below <tr id=group_1>...</tr> <tr id=el>...</tr> <tr id=el>...<tr> <tr id=group_2></tr> <tr
I have a table like below: Table A ---------- ID Field1 Field2 Field3 1

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.