Adding tables to the WordPress database. Any concerns? [duplicate] - mysql

This question already has answers here:
Additional tables in WordPress database
(2 answers)
Closed 8 years ago.
Is there any reason not to add a few tables to the WordPress database? I'm not too familiar with WordPress and wouldn't want all that data to get flattened if WordPress was updated or anything like that.

You can add tables to your database without any issue. WordPress will leave any custom tables untouched with updates.
I would ask yourself if the new table is really necessary. For example. If the new data really should just be a WordPress custom post type and stored in wp_posts. Or maybe stored in the meta tables.

Related

What is the effect of having empty tables in your database? [duplicate]

This question already has answers here:
Unused Database Table Effects
(5 answers)
Closed 3 years ago.
I have a few temporary tables that I use for a second, then clear out the data. Should I delete these tables after I finish using them or would it be okay to leave them?
It is OK to leave them.
You may wish from time to time to check the file size and run a Compact & Repair.

how to add comment to existing view in mysql [duplicate]

This question already has answers here:
Create comments for views in mysql
(4 answers)
Closed 6 years ago.
I want to ask you how add comment to view ( not table ) in MySQL. I tried something like this:
ALTER VIEW VIEWNAME COMMENT comment
but this not working.
You have to script the entire view, add the column to your query, and execute the change. You can't just add a field to the view like you would a table because it doesn't know where it should come from.

HTML Good or Bad Practice to Uniquely Identified Elements [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I am wondering if I have a table of whose size and content I dont know, and I want to manipulate its data, is it bad practice to add unique id's to each element?
For example lets say the table is representing information from a database.
Is it bad practice to have
<li id= ${database_element.id}>
A better example using this for loop, this displays a list of elements from a table in a database named files
<g:each in="${files}" var="d">
<a id = "${d.unique_id}" class = "file" href="somelink.com" ><image id = "iconImage" src="img/iconImage"/>
</a>
</g:each>
So now each element of the table has its unique id from the database.
Is this a good or bad idea, especially when it comes to file storage i.e file/folder ids?
The reason I am asking is I cant see any other way of manipulating individual elements of the table without this?
It's usually fine.
There would really need to be some good reason for it to be bad. I'll start a list of things...everybody feel free to add to this list...
There are weird characters in your database IDs and they didn't get converted well or HTML escaped properly.
The same thing as above, but going the other direction (from HTML ids to database IDs).
Your database IDs change for some odd reason, and then you send data back to the database using the old ID.
You pollute your ID namespace with these IDs, and then can't use numbers for other IDs (this could be solved by adding some prefix to your database ids, such as db-).
It really depends on your specific situation and I would just wait until you actually run into a problem before worrying about it.

Multiple databases or multiple row tables [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have a question about how big companies manage a database structure, let's say if i have an ecommerce app something like shopify which is the best approach you take:
a) When a new user creates an account a new database with his tables is created specifically for that user (i think if for some reason this database fail the other databases of other users remain working)?
b) When a new user creates an account Instead of create a new database, the app just create a new row in a table for his login and then all the products of all users are in the same table and only the user_id is the difference between one product of a store and another.
Thanks in advance.
Yeah, you should go for the second option (b), for alot of reasons:
1. Most of the data in your database shall be accessible for all users, so you don't want to have the same data stored in multiple places.
2. Sooner or later, you will come up with features where you want to share or link data between different users, etc.
3. Your first choice (a) would be extremely resource consuming compared to the second choice (b).
4. Well, the list can go on and on... :)
Obviously, the second choice - much more efficient and smarter.
Think about the number of the users, let's say 10k for example.
you realy don't want to handle this mass of tables!
I would go with Option B. This will reduce your work load and help in reporting needs down the road. Just make sure you use a robust database design to handle load when writing to database tables.

Adding comments to columns [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Alter MYSQL Table To Add Comments on Columns
Hi Guys,
I googled all over the place but I can't find the answer. I know you can add comments to your database columns. I already created a table but now i want to add comments to certain columns, my database programma (sequel pro) doesn't have a function to alter the columns with comments.
Is there an 'update' or 'alter' query to add comments to your columns? The database is in mysql.
Thanks!
UPDATE: found this. Now Trying if it's working
Just add
COMMENT "comment"
after your
ALTER TABLE xxx CHANGE xxx...