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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:39:47+00:00 2026-06-03T23:39:47+00:00

I need help trying set-up Foreign Keys after having difficulty following Music library MySQL

  • 0

I need help trying set-up Foreign Keys after having difficulty following Music library MySQL database. I have multiple tables: Albums, Songs, Genres, Music Videos, Solo, and Group. There are ids, names and other columns for each specific table. Each id is primary key with int(11). Solo and Group represent solo artists and groups. (soloID and groupID are the primary key for them)

Look again

It could be the way I set up my database.


Solo
•   djuIDs – int(11)
•   profilepic – varchar(255)
•   engname – varchar(255)
•   korname – varchar(255)
•   engbn – varchar(255)
•   occupation – set
•   recordlabel – varchar(255)
•   debut  - date
•   dateofbirth – date
•   officialsite -  varchar(255)
•   sitename –varchar(255)
•   page – varchar(255)
Group
•   djuIDs – int(11)
•   profilepic – varchar(255)
•   engname – text
•   korname – text
•   members – text
•   recordlabel – varchar(255)
•   debut – date
•   officialsite -  varchar(255)
•   sitename –varchar(255)
•   page – varchar(255)
Albums
•   albumID – int(11)
•   albumpic – varchar(255)
•   albumthpic – varchar(255)
•   albumTitle – varchar(255)
•   performer – varchar(255)
•   type – set (ex: ep, sp, studio)
•   titletrack – varchar(255)
•   genre
•   releasedate – date
•   distributor – varchar(255)
•   page – varchar(255)
Songs
•   songID – int(11)
•   albumpic – varchar(255)
•   tracknum – int(11)
•   songTitle – varchar(255)
•   performer – varchar(255)
•   album – varchar(255)
•   page – varchar(255)
Music Videos
•   mvID – int(11)
•   title – varchar(30)
•   mvpic – varchar(255)
•   performer – varchar(255)
•   album – varchar(255)
•   releasedate – date
•   vURL – varchar(255)
Genres
•   genreID – int(11)
•   genreName –varchar(30)
•   information – varchar(255)

  • 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-03T23:39:48+00:00Added an answer on June 3, 2026 at 11:39 pm

    I think that was one of my older answers… If you’ve used INT(11) as your primary keys, your foreign key definitions should look like something like the following table definitions for Artists and Albums:

    CREATE TABLE Artists (
      /* will later be defined as a FK Albums.artistid */
      id INT NOT NULL PRIMARY KEY,
      name VARCHAR(1024) NOT NULL,
      description TEXT
    ) ENGINE=InnoDB;
    
    CREATE TABLE Albums (
      id INT NOT NULL PRIMARY KEY,
      artistid INT NOT NULL,
      release_date DATETIME,
      genreid INT NOT NULL,
      picture BLOB,
      FOREIGN KEY (artistid) REFERENCES Artists (id),
      FOREIGN KEY (genreid) REFERENCES Genres (id)
    )  ENGINE=InnoDB;
    

    Since you have defined all your PK columns as INT(11), make sure that in the related tables you use the same data type. For example above, artistid INT NOT NULL assumes that the referenced column in Artists is defined as id INT NOT NULL.

    In the definition above, I have made the FK columns as NOT NULL, but that isn’t strictly necessary. You could, for example, have an album with a NULL artist. If you think that’s a possibility, you should be able to omit the NOT NULL in the column definitions.

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

Sidebar

Related Questions

I need some help on a MySQL query I'm trying to set up. I
I am trying to make SELECT statement for following situation and need help to
I need some help trying to come up with a way to set this
I've been trying to set up the parallax node correctly but need some help
I have a MySQL database table that stores the URLs of photos. I need
I need help trying to figure out how to set my 2nd condition ($column
I need some help trying to match a C include file with full path
Hey all i am in need of some help trying to figure out how
I need help with Android. I'm trying to create a slot machine game. So,
Two things I'm trying to achieve and need help with 1) Click a link

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.