7 Fields Every Database Table May Need …
No matter if you work with MySQL, MSSQL, PostgreSQL or another database system, there are some columns any database table most likely may need …
No matter if you work with MySQL, MSSQL, PostgreSQL or another database system, there are some columns any database table most likely may need …
Wer eine Webseite betreibt oder gar eine Webapplikation muss sich unweigerlich um Hosting und Server Administration kümmern. Dabei gibt es mittlerweile unendlich viele Möglichkeiten … aber jetzt kommt noch eine dazu: Platform as a Service (PaaS)
Keine Hardware Investitionen, nie wieder Server administrieren oder Sicherheitspatches einspielen müssen, das System skaliert automatisch und das Deploy wird einfacher: Das klingt doch alles wunderbar und das alles bietet SaaS!
Platform as a Service (PaaS) gibt es seit einigen Jahren für Java (Google AppEngine) oder für .NET (Microsoft Azure) aber für PHP sieht es derzeit noch etwas mau aus. Diese Lücke möchte jetzt cloudControl aus Potsdam schließen …
Replace strings with SQL in a field for all rows …
UPDATE `table` SET `field` = REPLACE(`field`, 'search string', 'replace with this') WHERE 1=1; |
via @vogrim
SELECT CHAR_LENGTH(field)-CHAR_LENGTH(REPLACE(field,’-',”)) AS count FROM table
Die neue PHP Version ist nun endgültig fertig und freigegeben. Zu den neuen Funktionen gehören Closures, Funktionsobjekte und Lambda-Funktionen, die native MySQL Library, namespaces und late static binding. Aber für mich am wichtigsten sind die Performance-Verbesserungen, PHP 5.3 wird ca. 1,5x so schnell sein wie 5.2 und durch den neuen Garbage Collector deutlich weniger Speicher verbrauchen.
Finally found the solution in the Ubuntu forums:
ln -s /etc/mysql/my.cnf /etc/my.cnf
Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ [Archive] – Ubuntu Forums.
Another problem … same error in phpMyAdmin cause the default for socket is “/tmp/mysql.sock”, you have to change that in your config file (config/config.inc.php):
[sourcecode language='php']
$cfg['Servers'][$i]['connect_type'] = ‘socket’;
$cfg['Servers'][$i]['socket'] = ‘/var/run/mysqld/mysqld.sock’;
[/sourcecode]
opensas opensas 1:29 am on August 31, 2011 Permalink |
I always have this fields
id (obvious) totally transparent to the user
code candidate unique key, known to the user
description
…
created_at
created_by (user id)
updated_at
updated_by
saludos
sas
opensas 1:29 am on August 31, 2011 Permalink |
I always have this fields
id (obvious) totally transparent to the user
code candidate unique key, known to the user
description
…
created_at
created_by (user id)
updated_at
updated_by
saludos
sas
Guest 7:33 am on August 31, 2011 Permalink |
Sorry… but three field doin the same… not really good database design..
Anonymous 8:03 am on August 31, 2011 Permalink |
sorry maybe i wrote it a bit mistakable … i use status OR hidden OR active … not all three together … that would be a bit much status-flags
Guest 7:33 am on August 31, 2011 Permalink |
Sorry… but three field doin the same… not really good database design..
MF 8:03 am on August 31, 2011 Permalink |
sorry maybe i wrote it a bit mistakable … i use status OR hidden OR active … not all three together … that would be a bit much status-flags
Anonymous 8:01 am on August 31, 2011 Permalink |
yes, userIds … i tought of it but don’t use it always … helps to find the guilty
MF 8:01 am on August 31, 2011 Permalink |
yes, userIds … i tought of it but don’t use it always … helps to find the guilty
Tomáš Záluský 8:56 am on August 31, 2011 Permalink |
Good checklist for designing new database but certainly not every table needs all columns stated here.
I would append “version” column for Hibernate optimistic locking.
Anonymous 8:59 am on August 31, 2011 Permalink |
you are right but i needed a good article title
… i don’t use hibernate … do you have a link how hibernate optimistic locking works?
Tomáš Záluský 8:56 am on August 31, 2011 Permalink |
Good checklist for designing new database but certainly not every table needs all columns stated here.
I would append “version” column for Hibernate optimistic locking.
MF 8:59 am on August 31, 2011 Permalink |
you are right but i needed a good article title
… i don’t use hibernate … do you have a link how hibernate optimistic locking works?
Concerned Global Citizen 7:09 pm on August 31, 2011 Permalink |
are you using an ORM that recognizes your Active columns? I imagine the WHERE clause if there are complex joins – it seems too complex to me. Also a description column in each table? talk about a candidate for normalization. This post has too much bad advice. – mec
Anonymous 7:34 pm on August 31, 2011 Permalink |
it’s just my experience that such fields can save you later headache … i avoid too complex joins … they are too slow (MySQL) and the ORM recognizes my status (active, …) as integer value (what do you mean with recognize?)
discription in many tables like company, user, product, …
btw: in general normalization is a good and important thing … but performance is (sometimes) better
what is your … better … advice?
Concerned Global Citizen 7:09 pm on August 31, 2011 Permalink |
are you using an ORM that recognizes your Active columns? I imagine the WHERE clause if there are complex joins – it seems too complex to me. Also a description column in each table? talk about a candidate for normalization. This post has too much bad advice. – mec
MF 7:34 pm on August 31, 2011 Permalink |
it’s just my experience that such fields can save you later headache … i avoid too complex joins … they are too slow (MySQL) and the ORM recognizes my status (active, …) as integer value (what do you mean with recognize?)
discription in many tables like company, user, product, …
btw: in general normalization is a good and important thing … but performance is (sometimes) better
what is your … better … advice?
Techbrainless 9:15 pm on September 3, 2011 Permalink |
Great post but i have got confused regarding the 3 columns
active, inactive or deleted
hidden or visible
status
1. ) can we merge them in a single column , because if we make test records then we can delete those test records and mark them as “deleted” ?
2. ) in status column you have mentioned that some of the status are active , inactive , ….
but this conflict with the colum called “active , inactive or deleted” could plz justify
Techbrainless 9:15 pm on September 3, 2011 Permalink |
Great post but i have got confused regarding the 3 columns
active, inactive or deleted
hidden or visible
status
1. ) can we merge them in a single column , because if we make test records then we can delete those test records and mark them as “deleted” ?
2. ) in status column you have mentioned that some of the status are active , inactive , ….
but this conflict with the colum called “active , inactive or deleted” could plz justify
Mymail 8:25 am on July 14, 2012 Permalink |
So many many bad advice !
This is exactly what you MUST NOT do !
I think you need to read about normalisation and you will increase performance !