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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:12:41+00:00 2026-06-04T06:12:41+00:00

I want to save weekdays in database, so i thought to store it by

  • 0

I want to save weekdays in database, so i thought to store it by assigning int value to each day. i.e

1 -> Selected, 0 -> Not Selected.

Monday = 0/1

Tuesday = 0/1

.
.
.
.
.

Sunday = 0/1.

But this will make 7 columns in DB. So I was thinking if anyone can help me with this if I should store it in a single array and retrieve the values for further use. I was reading some examples over internet but didn’t get it in a easy way.

  • 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-04T06:12:43+00:00Added an answer on June 4, 2026 at 6:12 am

    To insert 7 values in one column you can use comma separator like this

    where Total_Score_P1 is an string array

    //string array

    String[]  Total_Score =  new String[] { p1e1,p1e2,p1e3,p1e4,p1e5,p1e6 };
    
    
    // Convderting it into a single string 
    
    String result_ScoreP1 = ("" + Arrays.asList(Total_Score_P1)).
                 replaceAll("(^.|.$)", "  ").replace(", ", "  , " );
    

    result_ScoreP1 will be

    // output of this

    result_ScoreP1 = "p1e1,p1e2,p1e3,p1e4,p1e5,p1e6";
    

    insert it as a single string in database and
    when retrieve it in again break in parts like

    // a string array list

    // query fired

    public ArrayList<String> rulTable(String id) {
            // TODO Auto-generated method stub
            ArrayList<String> Ruleob = new ArrayList<String>();
    
            Cursor c_rule;
    
            try
            {
                c_rule = db.query(NameTable, new String[]{
                        columns1        
                },
                Rule_COurseID + "=" + id ,
                                  null, null, 
                                  null, null, null);
    
                c_rule.moveToFirst();
    
                // if there is data available after the cursor's pointer, add
                // it to the ArrayList that will be returned by the method.
                if (!c_rule.isAfterLast())
                {
                    do
                    {
    
                        Ruleob.add(c_rule.getString(0));
    
                    }
                    while (c_rule.moveToNext());
                }
    
                // let java know that you are through with the cursor.
                c_rule.close();
            }
            catch(Exception e)
            {
    
    
            }
            return Ruleob;
    
    
        }
    
    
    //list to get elements 
    
     ArrayList<String>  ListOne = new ArrayList<String>();
    
    ArrayList<String> row ;
    
        try{
    // received values
            row = db.TheTable(id);
            String r1 = row .get(0);
    
    }
    
    catch(Exception e)
    
    {
    
    }
    
    
     StringTokenizer st2 = new StringTokenizer(r1, "||");
    
                while(st2.hasMoreTokens()) {
                String Desc = st2.nextToken();
                   System.out.println(Desc+ "\t" ); 
                ListOne.add(Desc); 
    
    //   
                }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to save int value to a pointer variable. But I get an
I want to save my countries local time(new zealand) in my database. I am
I want to save some data into sqlite database and the read it, there
I want to save a String value on Android and have access to this
I want to save the following NSDictionary to a MySQL database: NSDictionary notesDictionary: object:
I want to save my domain class to the database without specifying the createdUser
I want to save an image to the database using SQLite. I send the
i want to save a byte[] in a table of SQLite Database (Field datatype
I want to save some specific records from a database to a file, thus:
I want to save many pictures into a SQL Server database file. How can

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.