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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:45:54+00:00 2026-05-16T04:45:54+00:00

I have sqlite3 database with example structure and data: CREATE TABLE person(id INTEGER PRIMARY

  • 0

I have sqlite3 database with example structure and data:

CREATE TABLE person(id INTEGER PRIMARY KEY NOT NULL, name STRING NOT NULL);
INSERT INTO "person" VALUES(1,'Jack');
INSERT INTO "person" VALUES(2,'Daniel');
INSERT INTO "person" VALUES(3,'Sam');
INSERT INTO "person" VALUES(4,'T`lc');
CREATE TABLE vote(person_id INTEGER NOT NULL, article_id NUMBER NOT NULL, FOREIGN KEY(person_id) REFERENCES person(id));
INSERT INTO "vote" VALUES(1,43256);
INSERT INTO "vote" VALUES(1,43436);
INSERT INTO "vote" VALUES(1,67388);
INSERT INTO "vote" VALUES(1,43678);
INSERT INTO "vote" VALUES(2,678);
INSERT INTO "vote" VALUES(2,6788);
INSERT INTO "vote" VALUES(2,67388);
INSERT INTO "vote" VALUES(4,67388);
INSERT INTO "vote" VALUES(4,67658);

Now I would like to (in one select query) find all persons witch:

  1. Do not vote at all
  2. Do not vote for article 67388

I have no ideas how to do this :/

help :'(

  • 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-16T04:45:54+00:00Added an answer on May 16, 2026 at 4:45 am

    Using OR:

    SELECT p.*
       FROM PERSON p
     WHERE NOT EXISTS(SELECT NULL
                                    FROM VOTE v
                                   WHERE v.person_id = p.id) -- no votes at all
           OR NOT EXISTS(SELECT NULL
                                     FROM VOTE v
                                    WHERE v.person_id = p.id
                                         AND v.article_id = 67388)
    

    Using UNION

    SELECT p.*
      FROM PERSON p
     WHERE NOT EXISTS(SELECT NULL
                                    FROM VOTE v
                                   WHERE v.person_id = p.id)
    UNION
    SELECT p.*
      FROM PERSON p
     WHERE NOT EXISTS(SELECT NULL
                                    FROM VOTE v
                                   WHERE v.person_id = p.id
                                        AND v.article_id = 67388)
    

    UNION is slower than UNION ALL, because it removes duplicates. If you want duplicates, just add the “ALL” keyword after “UNION”.

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

Sidebar

Related Questions

In this example we have 3 related tables on a SQLite database: CREATE TABLE
I have the following table in a SQLite3 database: CREATE TABLE overlap_results ( neighbors_of_annotation
I have a SQLite database with cyrillic rows in it. For example: CREATE TABLE
I have a table named coords with the following columns |name|lat|lon|und| import sqlite3 database
I have a SQlite3 table that has typeless columns like in this example: CREATE
I have a sqlite3 database in which I have corrupt data. I qualify corrupt
I have a table of events (in a sqlite3 database for what it's worth)
My database (sqlite3), has two tables with the following schemas: CREATE TABLE log(d date,
I have a such a data structure, ID NAME BIRTH AGE SEX ================================= 1
I have an sqlite table with the following structure: String CREATE_ACHIEVEMENTS_TABLE = CREATE TABLE

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.