Is it good database design to have admin users in the same table as front-end users?

Roles should be tracked separately from user accounts, because someone can be promoted (or demoted) over time. Would it make sense in that situation to have two different user accounts, in two different tables? I think not. Here’s the basic structure I’d use – USERS user_id (primary key) user_name ROLES role_id (primary key) role_name USER_ROLES … Read more

What mysql database tables and relationships would support a Q&A survey with conditional questions? [closed]

Survey Database Design Last Update: 5/3/2015 Diagram and SQL files now available at https://github.com/durrantm/survey If you use this (top) answer or any element, please add feedback on improvements !!! This is a real classic, done by thousands. They always seems ‘fairly simple’ to start with but to be good it’s actually pretty complex. To do … Read more

How to do Inheritance Modeling in Relational Databases?

Martin Fowler discusses this extensively in his book Patterns of Enterprise Application Architecture book. Get this book and look into: Single Table Inheritance Class Table Inheritance Concrete Table Inheritance The Website should give you some idea. You might also want to read the section on inheritance mappers. Each of the different approaches have their pros … Read more

Forward Chaining vs Backward Chaining

Backward chaining (a la Prolog) is more like finding what initial conditions form a path to your goal. At a very basic level it is a backward search from your goal to find conditions that will fulfil it. Backward chaining is used for interrogative applications (finding items that fulfil certain criteria) – one commercial example … Read more

Why use an auto-incrementing primary key when other unique fields exist?

Auto-incrementing primary keys are useful for several reasons: They allow duplicate user names as on Stack Overflow They allow the user name (or email address, if that’s used to login) to be changed (easily) Selects, joins and inserts are faster than varchar primary keys as its much faster to maintain a numeric index As you … Read more

What is an “order line”?

It refers to a “Purchase Order” which typically consists of one or more lines, called “Order Lines”. As almost every business on earth has some similar record of it’s orders, purchases and/or sales, it has been the canonical real-world data example of a Parent-Child (or Master-Detail) relationship for as long as databases have existed (well … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)