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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:56:54+00:00 2026-05-24T03:56:54+00:00

I am afraid that this question might be a little too broad, but I

  • 0

I am afraid that this question might be a little too broad, but I have little-to-none knowledge when it comes to database design, so I will explain what I have so far before I get to the question.

I have an excel file, which I exported into a csv file, which has the following (simplified) layout:

Region, License Number in 1st Year, License Number in 2nd Year, License Number in 3rd Year...

The idea is that the licenses are incremented and at the end of every year, I have a record of what is the highest license at the time for each region. Because there are almost as many regions as there are years, it makes sense the previous layout for an excel file because we have the data displayed in what is close to be a square, but for the database I believe that it could be easier to deal with it if I reduce the number of columns and I would have this:

Region, Year, License Number

Assuming that this is right (again, I am clueless when it comes to database design) my question is the following: how can I possibly convert all the data to the suggested format without having to manually create the (many) entries for each region and copy all the licenses into the corresponding years?

The goal is to be able to tell what year a license was issued by simply looking at the license number

  • 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-24T03:56:55+00:00Added an answer on May 24, 2026 at 3:56 am

    Looks like you’re on the right track. You’ll want a primary key on {region, year}.

    If you’re relatively new to databases, the procedure below will be the easiest both for you to understand and for you to get right the first try.

    One problem is that you don’t appear to be storing the years. If 1st year means the same year for every value in that Excel column–that is, 1st year doesn’t mean 2011 for one row, and 1999 for another–then you might be able to massage the data into shape easily just using a second worksheet.

    • Copy the two columns “Regions” and “License number in 1st year” to
      another worksheet.
    • If 1st year means, say, 2005, then insert a column between those
      two, copy the number 2005 all the way down the second column, and
      you’re done. (Done with 1st year, that is.)
    • Repeat for each year.
    • Export the results, and import them into your table.

    If you think you’re comfortable running queries, you can try this procedure.

    • Create a table for your data. I’m guessing at the data types.

      create table your_table_name (
      region varchar(35) not null,
      year integer not null check (year >= 1955),
      license_num integer not null check (license_num >= 0)
      );

    • Export your spreadsheet to CSV file. Consider changing the column
      names to the actual years.

    • Import into sqlite.

    Insert data into your_table_name.

    insert into your_table_name (region, year, license_num)
    select region_column_name, 1955, license_num_column_for_1955
    from imported_table_name
    

    Note carefully that you’ll need to adjust the literal year and the name of the column for that year each time you run the query.

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

Sidebar

Related Questions

i'm afraid that this is a stupid question, but i must assume that i
I'm afraid that this is a very silly question, but I must be missing
I'm afraid that I have a bit silly question, but I wasn't able to
I am afraid this question is not supposed to be asked here but I
A slightly archaic question I'm afraid but here goes: I have a program which
I'm afraid that this one is a little tricky since I couldn't recreate the
I'm afraid this is going to be a ridiculously stupid question, you might be
This might be a stupid question, but if I'm a lone developer and only
I am afraid I similar question might be already asked somewhere, but I wasn't
I have looked to no avail, and I'm afraid that it might be such

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.