Best practices to store CreditCard information into DataBase

DON’T DO IT There is simply far too much risk involved, and you will typically need to be externally audited to ensure that you’re complying with all the relevant local laws and security practises. There are many third-party companies that do it for you that have already gone through all trouble of making sure their … Read more

MySQL – Conditional Foreign Key Constraints

You’re attempting to do a design that is called Polymorphic Associations. That is, the foreign key may reference rows in any of several related tables. But a foreign key constraint must reference exactly one table. You can’t declare a foreign key that references different tables depending on the value in another column of your Comments … Read more

What are design patterns to support custom fields in an application?

I do agree with posters below that Options 3, 4, or 5 are most likely to be appropriate. However, each of your suggested implementations has its benefits and costs. I’d suggest choosing one by matching it to your specific requirements. For example: Option 1 pros: Fast to implement. Allows DB actions on custom fields (searching, … Read more

How to list all tables in PhpMyAdmin’s left menu?

Update: Thanks to @Cloudkiller, there’s another configuration setting that might need to be changed (as of 4.3.6) in addition to Update V4: $cfg[‘FirstLevelNavigationItems’] Update V4: According to Configuration Docs, you can modify: $cfg[‘MaxNavigationItems’] The number of items that can be displayed on each page of the navigation tree. Can also try: $cfg[‘MaxTableList’] The maximum number … Read more

MySQL stored procedures use them or not to use them

Unlike actual programming language code, they: not portable (every db has its own version of PL/SQL. Sometimes different versions of the same database are incompatible – I’ve seen it!) not easily testable – you need a real (dev) database instance to test them and thus unit testing their code as part of a build is … Read more

Standard use of ‘Z’ instead of NULL to represent missing data?

Sack your contractor. Okay, seriously, this isn’t standard practice. This can be seen simply because all RDBMS that I have ever worked with implement NULL, logic for NULL, take account of NULL in foreign keys, have different behaviour for NULL in COUNT, etc, etc. I would actually contend that using ‘Z’ or any other place … Read more

When is it better to store flags as a bitmask rather than using an associative table?

Splendid question! Firstly, let’s make some assumptions about “better”. I’m assuming you don’t much care about disk space – a bitmask is efficient from a space point of view, but I’m not sure that matters much if you’re using SQL server. I’m assuming you do care about speed. A bitmask can be very fast when … Read more