How to set up login/guest and checkout/add to cartHow could I handle heavy load and consistency for product...

Would these multi-classing house rules cause unintended problems?

How to explain planetary rings pulsating?

Program that converts a number to a letter of the alphabet

The effects of magnetism in radio transmissions

Why Smart Plugs don't require setting port forwarding on router and how to accomplish this with NodeMCU (ESP8266)

Can you earn endless XP using a Flameskull and its self-revival feature?

Why Normality assumption in linear regression

What makes the Forgotten Realms "forgotten"?

Checking for the existence of multiple directories

How to tag distinct options/entities without giving any an implicit priority or suggested order?

Placing an adverb between a verb and an object?

Isn't using the Extrusion Multiplier like cheating?

What is the purpose of easy combat scenarios that don't need resource expenditure?

How to acknowledge an embarrassing job interview, now that I work directly with the interviewer?

Contest math problem about crossing out numbers in the table

How should I handle players who ignore the session zero agreement?

Would a National Army of mercenaries be a feasible idea?

Parsing a string of key-value pairs as a dictionary

Typing Amharic inside a math equation?

Strange Sign on Lab Door

Eww, those bytes are gross

Quenching swords in dragon blood; why?

Can I become debt free or should I file for bankruptcy? How do I manage my debt and finances?

Can we use the stored gravitational potential energy of a building to produce power?



How to set up login/guest and checkout/add to cart


How could I handle heavy load and consistency for product inventory in online retailers?Two different ON DELETE paths, how do I need to change the schema?database design for dynamic menu barHow to change schema so that account_id reference is unique among 3 tablesShould login id and password be stored in separate tableIs following way is right Database model for following problem?Best way to model a single user with multiple usernamesExtra fields in user_role / roles tables or a new tableHow to record the links between payments, documents, and transactions, and settlements in a bookkeeping application?Am I on the right track for a customer user login database design?













2















I want to create an online store database. I want to give users the ability to 'add to cart' and 'check out' without login.



My idea is that if the user logs in, then I can save the information in tables ex(bag, order), but if the user wants to check out as guest than I can create a guest_unique_id and set up bag that way. Guest bag will be mannually deleted after 10 days.



The only issue I see is that sometimes account_id will be empty. I guess I can check to see if guest_unique_id is NULL then user has an account, if not then it is a guest.
What you guys think about this structure, is there a better way to do this?



enter image description here










share|improve this question
















bumped to the homepage by Community 8 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.




















    2















    I want to create an online store database. I want to give users the ability to 'add to cart' and 'check out' without login.



    My idea is that if the user logs in, then I can save the information in tables ex(bag, order), but if the user wants to check out as guest than I can create a guest_unique_id and set up bag that way. Guest bag will be mannually deleted after 10 days.



    The only issue I see is that sometimes account_id will be empty. I guess I can check to see if guest_unique_id is NULL then user has an account, if not then it is a guest.
    What you guys think about this structure, is there a better way to do this?



    enter image description here










    share|improve this question
















    bumped to the homepage by Community 8 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      2












      2








      2








      I want to create an online store database. I want to give users the ability to 'add to cart' and 'check out' without login.



      My idea is that if the user logs in, then I can save the information in tables ex(bag, order), but if the user wants to check out as guest than I can create a guest_unique_id and set up bag that way. Guest bag will be mannually deleted after 10 days.



      The only issue I see is that sometimes account_id will be empty. I guess I can check to see if guest_unique_id is NULL then user has an account, if not then it is a guest.
      What you guys think about this structure, is there a better way to do this?



      enter image description here










      share|improve this question
















      I want to create an online store database. I want to give users the ability to 'add to cart' and 'check out' without login.



      My idea is that if the user logs in, then I can save the information in tables ex(bag, order), but if the user wants to check out as guest than I can create a guest_unique_id and set up bag that way. Guest bag will be mannually deleted after 10 days.



      The only issue I see is that sometimes account_id will be empty. I guess I can check to see if guest_unique_id is NULL then user has an account, if not then it is a guest.
      What you guys think about this structure, is there a better way to do this?



      enter image description here







      database-design






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 9 '18 at 20:54









      Community

      1




      1










      asked Feb 9 '18 at 14:36









      davedave

      111




      111





      bumped to the homepage by Community 8 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 8 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          3 Answers
          3






          active

          oldest

          votes


















          0














          Why not have account_id always populated? When anyone who creates a shopping bag, they get an account_id auto assigned, but there's another field on the account table with a boolean is_guest flag set true by default. You could keep things like customer details in a separate table with a 1:1 map to the account table, for customers who do create accounts.



          Your challenge then is that you might have repeat customers with different account_ids, but might be worth it depending on how likely customers will create accounts.






          share|improve this answer































            0














            what about creating IS_ACCOUNT_TABLE and link account_ID with order or bag tables



            enter image description here






            share|improve this answer



















            • 1





              Did you make a new account, with a new name Dave/Bill?

              – LowlyDBA
              Feb 9 '18 at 18:39



















            0














            The best thing would be to create a separate Bag table for guest users ex. (GUEST_BAG_TB), create a column in this table called guest_ip_address to store their ip address and use that to track them, then on checkout since you will be collecting their email generate a random password and email it to them and automatically register them through that, then block them the next time they try to check out as a guest with the same email and ask them to login. From time to time, run a cron job and delete old entries in the GUEST_BAG_TB table if necessary. The IS_Guest boolean column in the IS_ACCOUNT_TB table will not be necessary.






            share|improve this answer

























              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "182"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f197498%2fhow-to-set-up-login-guest-and-checkout-add-to-cart%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              0














              Why not have account_id always populated? When anyone who creates a shopping bag, they get an account_id auto assigned, but there's another field on the account table with a boolean is_guest flag set true by default. You could keep things like customer details in a separate table with a 1:1 map to the account table, for customers who do create accounts.



              Your challenge then is that you might have repeat customers with different account_ids, but might be worth it depending on how likely customers will create accounts.






              share|improve this answer




























                0














                Why not have account_id always populated? When anyone who creates a shopping bag, they get an account_id auto assigned, but there's another field on the account table with a boolean is_guest flag set true by default. You could keep things like customer details in a separate table with a 1:1 map to the account table, for customers who do create accounts.



                Your challenge then is that you might have repeat customers with different account_ids, but might be worth it depending on how likely customers will create accounts.






                share|improve this answer


























                  0












                  0








                  0







                  Why not have account_id always populated? When anyone who creates a shopping bag, they get an account_id auto assigned, but there's another field on the account table with a boolean is_guest flag set true by default. You could keep things like customer details in a separate table with a 1:1 map to the account table, for customers who do create accounts.



                  Your challenge then is that you might have repeat customers with different account_ids, but might be worth it depending on how likely customers will create accounts.






                  share|improve this answer













                  Why not have account_id always populated? When anyone who creates a shopping bag, they get an account_id auto assigned, but there's another field on the account table with a boolean is_guest flag set true by default. You could keep things like customer details in a separate table with a 1:1 map to the account table, for customers who do create accounts.



                  Your challenge then is that you might have repeat customers with different account_ids, but might be worth it depending on how likely customers will create accounts.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Feb 9 '18 at 17:13









                  Randolph WestRandolph West

                  2,649215




                  2,649215

























                      0














                      what about creating IS_ACCOUNT_TABLE and link account_ID with order or bag tables



                      enter image description here






                      share|improve this answer



















                      • 1





                        Did you make a new account, with a new name Dave/Bill?

                        – LowlyDBA
                        Feb 9 '18 at 18:39
















                      0














                      what about creating IS_ACCOUNT_TABLE and link account_ID with order or bag tables



                      enter image description here






                      share|improve this answer



















                      • 1





                        Did you make a new account, with a new name Dave/Bill?

                        – LowlyDBA
                        Feb 9 '18 at 18:39














                      0












                      0








                      0







                      what about creating IS_ACCOUNT_TABLE and link account_ID with order or bag tables



                      enter image description here






                      share|improve this answer













                      what about creating IS_ACCOUNT_TABLE and link account_ID with order or bag tables



                      enter image description here







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Feb 9 '18 at 18:37









                      billbill

                      1




                      1








                      • 1





                        Did you make a new account, with a new name Dave/Bill?

                        – LowlyDBA
                        Feb 9 '18 at 18:39














                      • 1





                        Did you make a new account, with a new name Dave/Bill?

                        – LowlyDBA
                        Feb 9 '18 at 18:39








                      1




                      1





                      Did you make a new account, with a new name Dave/Bill?

                      – LowlyDBA
                      Feb 9 '18 at 18:39





                      Did you make a new account, with a new name Dave/Bill?

                      – LowlyDBA
                      Feb 9 '18 at 18:39











                      0














                      The best thing would be to create a separate Bag table for guest users ex. (GUEST_BAG_TB), create a column in this table called guest_ip_address to store their ip address and use that to track them, then on checkout since you will be collecting their email generate a random password and email it to them and automatically register them through that, then block them the next time they try to check out as a guest with the same email and ask them to login. From time to time, run a cron job and delete old entries in the GUEST_BAG_TB table if necessary. The IS_Guest boolean column in the IS_ACCOUNT_TB table will not be necessary.






                      share|improve this answer






























                        0














                        The best thing would be to create a separate Bag table for guest users ex. (GUEST_BAG_TB), create a column in this table called guest_ip_address to store their ip address and use that to track them, then on checkout since you will be collecting their email generate a random password and email it to them and automatically register them through that, then block them the next time they try to check out as a guest with the same email and ask them to login. From time to time, run a cron job and delete old entries in the GUEST_BAG_TB table if necessary. The IS_Guest boolean column in the IS_ACCOUNT_TB table will not be necessary.






                        share|improve this answer




























                          0












                          0








                          0







                          The best thing would be to create a separate Bag table for guest users ex. (GUEST_BAG_TB), create a column in this table called guest_ip_address to store their ip address and use that to track them, then on checkout since you will be collecting their email generate a random password and email it to them and automatically register them through that, then block them the next time they try to check out as a guest with the same email and ask them to login. From time to time, run a cron job and delete old entries in the GUEST_BAG_TB table if necessary. The IS_Guest boolean column in the IS_ACCOUNT_TB table will not be necessary.






                          share|improve this answer















                          The best thing would be to create a separate Bag table for guest users ex. (GUEST_BAG_TB), create a column in this table called guest_ip_address to store their ip address and use that to track them, then on checkout since you will be collecting their email generate a random password and email it to them and automatically register them through that, then block them the next time they try to check out as a guest with the same email and ask them to login. From time to time, run a cron job and delete old entries in the GUEST_BAG_TB table if necessary. The IS_Guest boolean column in the IS_ACCOUNT_TB table will not be necessary.







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Jul 20 '18 at 11:54

























                          answered Jul 20 '18 at 11:13









                          user6033723user6033723

                          11




                          11






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Database Administrators Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f197498%2fhow-to-set-up-login-guest-and-checkout-add-to-cart%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              ORA-01691 (unable to extend lob segment) even though my tablespace has AUTOEXTEND onORA-01692: unable to...

                              Always On Availability groups resolving state after failover - Remote harden of transaction...

                              Circunscripción electoral de Guipúzcoa Referencias Menú de navegaciónLas claves del sistema electoral en...