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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:57:45+00:00 2026-05-15T23:57:45+00:00

I do file parsing in Perl and insert into a table in a MySQL

  • 0

I do file parsing in Perl and insert into a table in a MySQL database. For example, I have the following fields:

S.No ,PCID,USERNAME, TIME   INFORMATION.
1     203  JANE      22:08  updation
2     203  JANE      22:09  deletion
3     203  JANE      22:10  insertion

In this table I wanted to have the PCID to be unique, USERNAME to be unique. S.No is unique, since I have set it to autonumbering and it’s the primary key. Now my question is:

If I add PCID and USERNAME as composite primary key, I still find duplicates in the table. There is no change. The same o/p. What should be done to remove the duplicate? Should I code in Perl to check for duplicates before insertion?

Please guide and provide assistance. Thanks in advance.

  • 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-15T23:57:45+00:00Added an answer on May 15, 2026 at 11:57 pm

    You want the S.No to remain the primary key and PCID + USERNAME to be unique, so close to what Hammerite said:

    ALTER TABLE MyTable
        ADD PRIMARY KEY (`S.No`),
        ADD UNIQUE KEY `PCID_USER_uk` (`PCID`, `USERNAME`);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a script file for parsing through a SQLite database. I now need
I'm parsing a xml file & storing it in Database [using perl]. At the
Having a lot of pain with the following Perl file parsing code [last reply
I have a perl script that does a lot of config file parsing for
Perl is really good for writing the kind of string/file parsing programs that I
I have developed a file parsing application on the android platform. How do I
I have student.xml file and am parsing this file using SAX Parser and now
Perl newbie here. I have a log file that I need to parse out
Question abstract: how to parse text file into two hashes in Perl. One store
I have run into a regex in Perl that seems to be giving me

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.