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

  • Home
  • SEARCH
  • 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 8857597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:37:45+00:00 2026-06-14T14:37:45+00:00

My Create table Query is:– String CREATE_LOGIN_TABLE =CREATE TABLE IF NOT EXIST + TABLE_FORWARDMSG

  • 0

My Create table Query is:–

     String CREATE_LOGIN_TABLE ="CREATE TABLE IF NOT EXIST "+ TABLE_FORWARDMSG +"("+KEY_ID+ " INTEGER PRIMARY KEY AUTOINCREMENT,"+KEY_MSG_BODY+ " TEXT UNIQUE,"+KEY_MSG_ADDRESS+" TEXT UNIQUE,"+KEY_MSG_DATE+" TEXT UNIQUE" +")";

and I am access values From This Code:—

String selectQuery="SELECT * FROM "+TABLE_FORWARDMSG;
     SQLiteDatabase db=this.getReadableDatabase();
 Cursor cursor=db.rawQuery(selectQuery, null);
  if( cursor.moveToFirst()){

        for(int i=0;i<cursor.getCount();i++){
            map.put("msgBody", cursor.getString(1));
            map.put("msgAddress", cursor.getString(2));
            map.put("msgDate", cursor.getString(3));
            user.add(map);
            cursor.moveToNext();

        }

       }
        cursor.close();
        db.close();

Now My Problem is that:—-

If I remove UNIQUE from the CREATE TABLE Then I get all duplicate values means if I insert same value it create new row, and if I am using UNIQUE in CREATE TABLE, then every time cur.getCount() value is 1. I am new in SQLite. Please tell me whats the problem.

  • 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-14T14:37:47+00:00Added an answer on June 14, 2026 at 2:37 pm

    Your code looks like Ok. Maybe you shouldn’t make KEY_MSG_DATE like UNIQUE. Try to get more info about what you want to do.

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

Sidebar

Related Questions

CREATE TABLE QRes ( QUERY_ID VARCHAR2(32) NOT NULL, PRIMARY KEY (QR_ID), SOURCE VARCHAR2(255), CONSTRAINT
Table 1 : QUERY: Create table client ( applicationNo int primary key, name varchar(20)
Query was this: CREATE TABLE `query` ( `id` int(11) NOT NULL auto_increment, `searchquery` varchar(255)
I am running following query in SQL*Plus CREATE TABLE tbl_audit_trail ( id NUMBER(11) NOT
Error SQL query: CREATE TABLE Contacts( Contact_ID INT NOT NULL , User VARCHAR NOT
If I have the following SQL query CREATE TABLE #t1 (a INT NOT NULL
I have the following SQLite query: CREATE TABLE Logs ( Id integer IDENTITY (1,
Can I fire show create table query in Java code for mysql? What I
I create a table by query below CREATE TABLE testing( test_field VARCHAR(20) CHECK(test_field like
Say I have written a Create Table script in a query window and run

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.