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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:27:32+00:00 2026-06-04T09:27:32+00:00

I have days table created as follows create table days( + day_id integer primary

  • 0

I have “days” table created as follows

"create table days(" +
            "day_id  integer primary key autoincrement, " +
            "conference_id integer , " +
            "day_date text, " +
            "day_start_time text, " +
            "day_end_time text, " +
            "day_summary text, " +
            "day_description text)";

and i have tracks table created as follows

CREATE_TABLE_TRACK = "create table track(" +
        "track_id integer primary key autoincrement," +
        "day_id integer,"+
        "track_name text," +
        "track_description text," +
        " FOREIGN KEY(day_id) REFERENCES days(day_id) ON DELETE CASCADE )";

as shown above i have foreign key day_id referencing to the day_id of table days…

So what i want is if i delete the day then corresponding track should also be deleted… But it does’t happen in my case..

I have sqlite with version 3.5.9

And also i have added 1 line in my helper class as

> db.execSQL(“PRAGMA foreign_keys=ON;”);

but is still won’t work.. please help me out..

  • 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-04T09:27:33+00:00Added an answer on June 4, 2026 at 9:27 am

    Cascading delete isn’t supported until Sqlite version 3.6.19, which is first included on Android 2.2.

    Fortunately there is an alternative.

    You can execute another query like this below your create table query:

    db.execSQL("CREATE TRIGGER delete_days_with track BEFORE DELETE ON track "
           +  "FOR EACH ROW BEGIN"
           +         " DELETE FROM days WHERE track.day_id = days.day_id "
           +  "END;");
    

    Note that delete_days_with_track is just a name descriptive of what the trigger does, and this is just the pattern I use; I believe you could name it anything you wish.

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

Sidebar

Related Questions

I have a table in SQLite: CREATE TABLE EventType ( [EventTypeID] INTEGER PRIMARY KEY,
I have a mysql table as follows. CREATE TABLE `events` ( `event_id` int(11) NOT
Hi I made this site a while ago in my table days but have
I currently have the following row in my table: course_data: user_id days <-- This
On a previous question a table could be created and populated with the days
I have a large table with 1 million+ records. Unfortunately, the person who created
I have a CHANGES table with fields VALUE(integer) and CREATED_AT(timestamp). I want to know
I have two tables in my MySQL database, users and tweets, as follows: TABLE
I have a table which contains hourly records (spanning multiple days). What I'd like
I have spent days trying to figure this out to no avail. I have

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.