Increasing order one statement at a time.
Nov. 27th, 2007 10:22 am![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
I'm slowly making changes to both our website's backend database and the SQL statements that the site uses. For lo, I'm tired of it always being shitty, but the chances of me having a week to make sweeping changes are exceedingly low.
Today, I changed a query in the PHP:
From:
To:
Why?
- Knowing where values are going is good. Lord knows we don't comment anything around here.
- Makes it way easier to add or remove a column.
- Why waste time always inserting null values?
- It's good SQL practices, goddammit.
If this gets changed, then the part of me that's always annoyed by our site will be less annoyed. And that will be Good.
In case you ever wondered what pleases me, this is an example.
Today, I changed a query in the PHP:
From:
INSERT INTO table VALUES ('name', 'email', null, null, 0)
To:
INSERT INTO table (colName, colEmail, colUses) VALUES ('name', 'email', 0)
Why?
- Knowing where values are going is good. Lord knows we don't comment anything around here.
- Makes it way easier to add or remove a column.
- Why waste time always inserting null values?
- It's good SQL practices, goddammit.
If this gets changed, then the part of me that's always annoyed by our site will be less annoyed. And that will be Good.
In case you ever wondered what pleases me, this is an example.
(no subject)
Date: 2007-11-27 06:58 pm (UTC)