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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:58:31+00:00 2026-06-01T20:58:31+00:00

I am currently creating a database, it allows a user to upload a publication,

  • 0

I am currently creating a database, it allows a user to upload a publication, which is stored in a table called paper, it stores the paper_id, title, abstract filename and topic_id .I have a table called topic which has topic_id and topic_name which i use for the user to select a topic for their publication. However i want the user to be able to select at least 3 topics, is this possible using this system? I have run out of ideas of how to do it and help would be greatly appreciated

  • 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-01T20:58:33+00:00Added an answer on June 1, 2026 at 8:58 pm

    Don’t store topic_id in the paper table. Instead, create another normalized (many-to-many) table which links topic_id to paper_id.

    /* Each paper can exist in this table as many times as necessary for all its topics */
    CREATE TABLE paper_topics (
      paper_id INT NOT NULL,
      topic_id INT NOT NULL,
      FOREIGN KEY (paper_id) REFERENCES paper (paper_id),
      FOREIGN KEY (topic_id) REFERENCES topic (topic_id),
      PRIMARY KEY (paper_id, topic_id)
    );
    

    This will allow you to store as many topics per paper as necessary.

    To retrieve the topics for a paper, use:

    SELECT 
      paper.*,
      topic_name
    FROM 
      paper
      LEFT JOIN paper_topics ON paper.paper_id = topic.paper_id
      LEFT JOIN topic ON topic.topic_id = paper_topic.topic_id
    WHERE paper.paper_id = <some paper id value>
    

    It is just about never a good idea to attempt to store multiple values in one column (such as a comma-separated list of topic_id in the paper table). The reason is that in order to query against it, you must use FIND_IN_SET() which drives up the complexity of performing joins and makes it impossible to utilize a column index when querying.

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

Sidebar

Related Questions

I am currently creating an iOS app, which connects to a database and asynchronously
I am currently creating a type of classifieds website, and when the user enters
I'm currently creating a user interface using WPF and would like to display a
I am currently creating a service which connects to a DAL and that can
I'm currently creating a WinForm in VB.NET bound to an access database. Basically what
I am currently working on a project which allows users to design a small
I am currently creating a website in php that has a database backend (can
I've got a stored procedure that allows an IN parameter specify what database to
I am currently creating a website that allows anonymous users to input data (or
I am current in planning on creating a big database (2+ million rows) with

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.