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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:20:40+00:00 2026-05-28T05:20:40+00:00

A noob question. I’m putting together my first database and have the following design

  • 0

A noob question. I’m putting together my first database and have the following design problem: I have a class which defines a book (e.g. it’s title) and a class which defines a page (e.g. it’s design).

The table for the class book would look so:

Title        | PAGE1        | PAGE2        | PAGE3
Book-One     | SAMPLE1-UUID | SAMPLE2-UUID | SAMPLE3-UUID
Book-Two     | SAMPLE4-UUID | SAMPLE5-UUID | SAMPLE6-UUID

The table for the class page:

UUID         | FONT         | CONTENTS etc.
SAMPLE1-UUID | Times        | Example
SAMPLE2-UUID | Arial        | Example Two
SAMPLE3-UUID | Verdena      | Example Three

Now, as each page is unique and can’t be re-used in another book, I can’t use a many-to-many relationship for Pages. I could use Foreign-Key to link the two tables, i.e. link SAMPLE1-UUID of the Books Table with the SAMPLE1-UUID of the Pages Table. This has the advantage of not creating the same entry twice.

However, I don’t like the idea of having a fixed amount of rows for my pages. In the above example for the class Book, I’d have to define a certain set of Pages, like PAGE1, PAGE2, PAGE3, PAGE4, … PAGE99. Ideally, all I need is a flexible list of pages for my book class, like so:

Name         | Pages
Book-One     | "SAMPLE1-UUID, SAMPLE2-UUID"
Book-Two     | "SAMPLE4-UUID, SAMPLE5-UUID, SAMPLE6-UUID"

Pages would be a simple CharField and its contents would be a list. But then I have the problem that the two tables are not linked anymore and that I’d have to create each entry twice (i.e. I would have to enter SAMPLE1-UUID in both the pages and books table).

Is there another way to design this database? Thanks for any suggestion!

  • 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-28T05:20:41+00:00Added an answer on May 28, 2026 at 5:20 am

    I’ll suggest you don’t have the pages as columns:

    The table for the class book would look so with book only information:

    Title        | ISBN         
    Book-One     | XXXXXXXXXXXX 
    Book-Two     | YYYYYYYYYYYY 
    

    The table for the class page:

    BOOKID       |PAGE_NUM | FONT         | CONTENTS
    1            |1        | Times        | Example
    1            |2        | Arial        | Example Two
    2            |1        | Verdena      | Example Three
    

    Your class design would look something like:

    class Book(models.Model):
        title = models.CharField(max_length=100)
        isbn = models.CharField(max_length=100)
    
    class Page(models.Model):
        book = models.ForeignKey(Book)
        page_num = models.IntegerField()
        font = models.charField(max_length=100)
        content = models.TextField()
    

    You can go ahead and have contraints so that a book and page_num does not repeat for instance but this can be a good start.

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

Sidebar

Related Questions

Sorry for noob question. Assuming we have a model with relation: class Book(models.Model): name
Noob question. I have this situation where I have these objects: class Address {
A noob question, I'm afraid. I have a database with several classes, among them
another noob question regarding F#. If I have the following code... let ExeC =
Noob question (probably). I have a class with a var textFieldObjets:Textfield in my class
a noob question here. I have the following code: - (IBAction)selectExistingPicture { if ([UIImagePickerController
Noob question here. If I have Class A with an array float itemsPosition[20][20] and
Javascript noob question - which one of the following is best practice and performance
Noob question here. I'm following this example/tutorial to try and isolate a problem I
Noob question : I have the following Forms layout (please excuse the JRuby syntax).

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.