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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:24:05+00:00 2026-05-30T10:24:05+00:00

I have two tables, theme and quiz , here is their definition: CREATE TABLE

  • 0

I have two tables, theme and quiz, here is their definition:

CREATE TABLE "theme" (
    "id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
    "nom" VARCHAR NOT NULL);

CREATE TABLE quiz(
     id         INTEGER PRIMARY KEY,
     nom        VARCHAR(256) NOT NULL,
     theme      INTEGER NOT NULL,
     niveau     INTEGER NOT NULL,
     pass       INTEGER DEFAULT 1  NOT NULL,
     jok        INTEGER DEFAULT 1 NOT NULL,
     etat       INTEGER DEFAULT 0 NOT NULL,
     FOREIGN KEY (theme) REFERENCES theme(id)
);

The field id (the primary key) in the table theme is a Foreign Key in the quiz table.

When i try to insert a record in the table quiz which contain the value 30 for example as a foreign key, the record is inserted successfully in the quiz table although there is no record in the theme table with the id = 30.

Wasn’t supposed to interdict this insert since i had a Foreign key constraint?

  • 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-30T10:24:06+00:00Added an answer on May 30, 2026 at 10:24 am

    Are you sure foreign key support is enabled?

    Assuming the library is compiled with foreign key constraints enabled,
    it must still be enabled by the application at runtime, using the
    PRAGMA foreign_keys command. For example:

    sqlite> PRAGMA foreign_keys = ON;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables: gallery and pictures: gallery id int (auto increment, primary key)
I have two tables like these: CREATE TABLE people ( id INT NOT NULL,
If I have these two tables: <table> <tr> <td>Small Length Content</td> </tr> </table> <table>
I have joining two tables,There are hundreds of records in table a and there
I have two tables. Table1 is our main table of data and Table2 has
Here's my scenario: I have two tables A, B which (for the sake of
I have two tables (1) MonthlyTarget {SalesManCode, TargetMonthYear, TargetValue}; this table has 1966177 rows.
I have two db tables. One table contains Forecast data. The second table contains
I have two tables, that share the same definition. I commonly insert new objects
I have two tables like Parent-Child. In Parent table, there are 7211 records. In

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.