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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:17:46+00:00 2026-05-27T06:17:46+00:00

I need help designing a SQL table. Suppose I have cardnumber , cardtype ,

  • 0

I need help designing a SQL table. Suppose I have cardnumber, cardtype, field1, field2, and field3.

Cardtype is an enumeration that can be “front”, “back”, or “both”.

  1. I want to SELECT front.field1, front.field2, front.field3, back.field1, back.field2, back.field3 FROM some table or view WHERE cardnumber=XXX.

  2. Most of the records will just contain field1, field2, field3, and “both” indicating that I should get front.field1 to be the same as back.field1, etc… when I SELECT. When “front” and “back” are different, I will need two rows with the same cardnumber, but one with “front” and the other with “back”, along with the appropriate field1…field3 for each side.

How do I design this table. Should I be using some VIEW of an INNER JOIN or a LEFT/RIGHT JOIN of some sort?

I’m open to different designs but I am hoping that any design will be easy to maintain (taking into account that most records will be one row containing “both”) and can satisfy my SELECT requirement.

  • 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-27T06:17:47+00:00Added an answer on May 27, 2026 at 6:17 am
    Card
    --------------------------------------------
    CardNumber     CardType_id    field1     etc
    
    CardType
    --------------------------------------------
    ID     Description
    
    
    SELECT
         Card.*,
         CardType.Description
    FROM Card
              INNER JOIN CardType
                    ON Card.CardType_id = CardType.ID
    WHERE CardType.Description = 'your description value'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All - I need some help designing a table for a Postgre SQL database.
I have a small database that I need help designing. I have a VB.NET
I can use some help for a designing my COMport connection classes. I have
I need help designing a query that will be used to return a website's
Need help with technical-designing of a website. I have a main page with a
I need some help designing a friends system The mysql table: friends_ list -
I need help designing an algorithm for recommendations on movies. Every user in the
I am designing a job rota planner for a company and need help displaying
I'm relatively new to the world of WhiteBox Testing and need help designing a
Let's say that I'm currently designing an application where I will need to use

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.