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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:11:00+00:00 2026-05-15T23:11:00+00:00

I have two pieces of data: 1) User and 2) Portfolio. Each user has

  • 0

I have two pieces of data: 1) User and 2) Portfolio. Each user has only one portfolio. At the registration process user has to fill out the following fields:

  • First name
  • Last name
  • Porfolio title
  • Portfolio url
  • Email
  • Password

My DB structure at the moment looks like this:

CREATE TABLE `User` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `email` varchar(80) NOT NULL,
  `password` varchar(128) NOT NULL,
  `firstName` varchar(30) NOT NULL,
  `lastName` varchar(30) NOT NULL,
  `ip` varchar(15) NOT NULL,
  `lastVisit` int(10) NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '2',
  `created` int(10) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id_UNIQUE` (`id`),
  UNIQUE KEY `email_UNIQUE` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;


CREATE TABLE `Portfolio` (
  `userId` int(11) NOT NULL,
  `title` varchar(255) NOT NULL,
  `url` varchar(45) NOT NULL,
  `theme` tinyint(2) NOT NULL DEFAULT '1',
  `font` tinyint(2) NOT NULL DEFAULT '1',
  `footer` varchar(255) NOT NULL,
  `isFeatured` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`userId`),
  UNIQUE KEY `id_UNIQUE` (`userId`),
  UNIQUE KEY `url_UNIQUE` (`url`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

But now looking at the database I think there is no reason to have two separate tables. The other thing is I don’t really want to mix user fields and portfolio fields.

What would you do in this case?

Any suggestions are greatly appreciated.

Thank you!

  • 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-15T23:11:00+00:00Added an answer on May 15, 2026 at 11:11 pm

    Scenarios in which you might want to keep them separate:

    • A User can exist without having a Portfolio (do you have other types of users besides those who have portfolios?).

    • A new Portfolio can be created for a User who didn’t have one.

    • Two users can swap portfolios (actually this would be tricky since the userid is the primary key of Portfolios).

    • You might someday support multiple Portfolios per User, or multiple Users per Portfolio, or both.

    • You want to manage SQL privileges to give some database user access to one table but not the other (and don’t have a database that supports column-level privileges or view-level privileges).

    • You want to back up the two tables separately.

    • You want to monitor space consumed by the two tables separately.

    • You really, really like to use SELECT * instead of naming columns explicitly, and you still want to be able to select each subset of columns. And you don’t want to use views for that.

    • You want to get the most out of your InnoDB buffer pool for performance, and buffering smaller rows means you store more rows in the same size buffer. Tip: declare ip as int unsigned instead of varchar(15).

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

Sidebar

Related Questions

Suppose we have many user processes running on Linux. Each process has many threads
If I have two pieces of character data, what is the best way to
I have two pieces of code. The first one is what I wanted. BUt
I have a list of tuples pairing two pieces of data... I'd like to
I have some large data files and I want to copy out certain pieces
I have two pieces of data in a multi-level array (object?) that I'm referencing
I have two webpages, the one that you fill the information and another that
I have a XML layout which has two edit text fields, one for title
I have two pieces of C++ code running on 2 different cores. Both of
I have two essentially separate applications for configuring two pieces of hardware sold by

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.