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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:56:51+00:00 2026-05-23T14:56:51+00:00

I am new to sql and I was wondering how i can add a

  • 0

I am new to sql and I was wondering how i can add a list to a database. Here is what I mean:

I have an a java class like this that i want to insert its info into a db:

public class Dog{

  private int dog_id;
  private String dog_name;
  private ArrayList<String> dog_friends;

}

Every dog object will have a different amount size of friends. My question is how i can add this list to the db. I was planning on having 3 columns (id,name,list), I just dont know how to add a list.

  • 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-23T14:56:52+00:00Added an answer on May 23, 2026 at 2:56 pm

    What you have is, in the relational database world, called a one-to-many relationship, and it requires two database tables to represent the information.

    In your first table, you’ll have id and name; in your second table you’ll have dog_id, friend_id and dog_friend.

    There will be possibly many entries in the second table for every entry in the first table. When you insert a row in the second table, be sure to set dog_id to match the id in the first table.

    With this structure, you can use JOINs in your SQL query to get all the information at once, or query the tables independently, depending on your needs.

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

Sidebar

Related Questions

I would like to be able to add a new SQL LOGIN and name
I was just wondering if this is possible. I have a site that admins
I have a desktop application that uses an SQL Server CE 3.5 database. I
I don't know SQL Geospatial new feature. I'm wondering if I can use to
I am new to sql and I am wondering if somebody can tell me
I'm fairly new to sql and was hoping that someone can help me with
I am new to SQL Server Management Studio and am wondering: is there is
I'm new to SQL Server Reporting Services, and was wondering the best way to
SQL Server 2008 has new geo data types. One thing I am wondering though
Question: The new SQL Server 2008 database returns me values formatted English (date/float). Is

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.