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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:59:14+00:00 2026-06-13T22:59:14+00:00

Suppose I have a table : Table A: Id Name Movie Comment 1 Foo

  • 0

Suppose I have a table :

Table A:

Id Name     Movie   Comment 

1  Foo     Bar  anything
2  Foo     Bar  anything

Here I want to make sure that the user cannot insert Foo and Bar twice , but he is allowed to insert Foo , foobar .
One solution to prevent this duplication was to add this statement ALTER TABLE table ADD UNIQUE KEY(Name , Movie). That was probably for sql not sqlite. I wrote the same command in python for sqlite3 as cur.execute("ALTER TABLE ADD UNIQUE KEY(Name,Movie)"). It gave me the error sqlite3.operationalerror: near “unique” syntax error. Is there anything that can be done while creating the table A , or is there any mistake in my sqlite query .

Help is appreciated .

  • 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-13T22:59:14+00:00Added an answer on June 13, 2026 at 10:59 pm
    CREATE UNIQUE INDEX IDX_Movies ON table(Name, Movie)
    

    This is standard SQL, and documented at http://sqlite.org/lang_createindex.html. (SQLite’s on-line documentation is pretty comprehensive)

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

Sidebar

Related Questions

Suppose I have a table foo with schema (name, age). So the table looks
Suppose I have a table as follows in MySQL: create table user(name varchar(20), join_time
Suppose that I have a table Person(Name, Hobby) and there are 3 hobbies in
Suppose you have these tables: Table Name: Salesman Fields: S_ID(Primary Key), Name Table Name:
Suppose i have a mysql table name table with fields rank date id The
Suppose I have this table: id | name | city ------------------ 1 | n1
Let's suppose I have all of these already provided: The name of a table
Suppose I have the code like this: <table> <tr> <th>name</td> <th>price</td> </tr> <tr> <td>a</td>
Suppose I have table A with a field that can be either 1 or
Suppose I have table Person table Employee, which inherits Person. I want to get

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.