Re: Accountability with MySQL

2006-03-16 Thread Martijn Tonies
From: James Harvard At 7:28 pm +0100 14/3/06, Martijn Tonies wrote: Given that NULLs basically means the absence of a value (eg: unknown), you shouldn't be storing NULLs. At 1:49 pm -0500 14/3/06, Rhino wrote: A null means unknown or not applicable and is a perfectly valid value to use in

Re: Accountability with MySQL

2006-03-16 Thread Mark Leith
Martijn Tonies wrote: We're arguing about whether or not your database design (as stored on disk) should contain NULLs. IMO: no, or at least as few as possible. I believe the answer really is - *it depends*. You are both right, really. Martijn, yes, according to academia and proper

Re: Accountability with MySQL

2006-03-16 Thread Martijn Tonies
From: Mark Leith Martijn Tonies wrote: We're arguing about whether or not your database design (as stored on disk) should contain NULLs. IMO: no, or at least as few as possible. I believe the answer really is - *it depends*. You are both right, really. Martijn, yes, according to

Re: Accountability with MySQL

2006-03-16 Thread James Harvard
But (in at least some situations) is not appropriate to record that you know that you don't have a value? I think the words of Donald Rumsfeld are appropriate here: There are known knowns. These are things we know that we know. There are known unknowns. That is to say, there are things that we

Re: Accountability with MySQL

2006-03-16 Thread Martijn Tonies
But (in at least some situations) is not appropriate to record that you know that you don't have a value? Sure it would. It it's needed. But the answer doesn't have to be a NULL. Remember the example about recording the fact that a student did not make a test for whatever reason? It was

Re: Accountability with MySQL

2006-03-16 Thread Alec . Cawley
Martijn Tonies [EMAIL PROTECTED] wrote on 16/03/2006 11:02:32: Well, the question still is if you should store unknown at all ;) Not according to Date: you should store what is known. See the remarks about the true propositions, from which relational databases are derived (but you probably

Coalesce (was: Re: Accountability with MySQL)

2006-03-16 Thread Martijn Tonies
Ah well, SQL (these days) provides plenty of functions to avoid the problems. Coalesce being one of them... How often do people write: (probably not valid MySQL) select firstname || coalesce(middlename || ' ', ' ') || lastname from ... Your syntax isn't quite correct; coalesce

Re: Accountability with MySQL

2006-03-16 Thread Martijn Tonies
From: [EMAIL PROTECTED] Martijn Tonies [EMAIL PROTECTED] wrote on 16/03/2006 11:02:32: Well, the question still is if you should store unknown at all ;) Not according to Date: you should store what is known. See the remarks about the true propositions, from which relational databases are

Re: Accountability with MySQL

2006-03-16 Thread Alec . Cawley
Martijn Tonies [EMAIL PROTECTED] wrote on 16/03/2006 11:32:45: From: [EMAIL PROTECTED] Martijn Tonies [EMAIL PROTECTED] wrote on 16/03/2006 11:02:32: Well, the question still is if you should store unknown at all ;) Not according to Date: you should store what is known. See the

Re: Accountability with MySQL

2006-03-16 Thread Martijn Tonies
in order to retrieve all the information about them. Replacing a theoretically ugly null flag with a 10 way join strikes me, as an engineer rather than a theoretician, the wrong side of the elegance/practicality trade-off. Using NULLs as well as de-normalization brings the risk

Re: Accountability with MySQL

2006-03-16 Thread James Harvard
Also, surely if you left join to a table then if there's no matching row you get a null value in your result set. So I'm not sure what the difference is between getting that null because you store it in a column in the primary table, and deriving it by left joining to a related table with no

Re: Accountability with MySQL

2006-03-16 Thread Martijn Tonies
James, Also, surely if you left join to a table then if there's no matching row you get a null value in your result set. So I'm not sure what the difference is between getting that null because you store it in a column in the primary table, and deriving it by left joining to a related table

True Propositions (was Re: Accountability with MySQL)

2006-03-16 Thread Martijn Tonies
Read the literature on how to design databases. What you do is storing true propositions. That is, each attribute defines a certain true proposition. For example: Employee Martijn has Employee# 14. You should be able to derive these sentences from every row. Putting a NULL

RE: Accountability with MySQL

2006-03-16 Thread Gordon
magazine. In the end I believe they agreed to disagree. -Original Message- From: Martijn Tonies [mailto:[EMAIL PROTECTED] Sent: Thursday, March 16, 2006 5:33 AM To: mysql@lists.mysql.com Subject: Re: Accountability with MySQL From: [EMAIL PROTECTED] Martijn Tonies [EMAIL PROTECTED] wrote

On MySQL Views (Re: Accountability with MySQL)

2006-03-16 Thread Martijn Tonies
Hello Gordon, And now we are down to reality. This is a MySQL list. Views are a wonderful thing for creating an isolation layer between the application and the database. However, MySQL's current implementation makes it extremely difficult in many cases to avoid full table scans when you

Re: Accountability with MySQL

2006-03-15 Thread Rhino
- Original Message - From: Martijn Tonies [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Wednesday, March 15, 2006 2:53 AM Subject: Re: Accountability with MySQL Basics of database design: store what you know. Given that NULLs basically means the absence of a value (eg

Re: Accountability with MySQL

2006-03-15 Thread Martijn Tonies
Hello, (please read all before replying) Basics of database design: store what you know. Given that NULLs basically means the absence of a value (eg: unknown), you shouldn't be storing NULLs. Nonsense!! That's a bold statement ... That's simply wrong. A null

Re: Accountability with MySQL

2006-03-15 Thread Rhino
- Original Message - From: Martijn Tonies [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Wednesday, March 15, 2006 10:47 AM Subject: Re: Accountability with MySQL Hello, (please read all before replying) Basics of database design: store what you know. Given that NULLs

Re: Accountability with MySQL

2006-03-15 Thread Stephen Cook
A commonly used example (at least at my last 3 jobs) would be a table of demographics for people (whether they be employees, clients, whatever). You can have one table and allow NULLs for some of the fields (id, LastName, FirstName, MiddleInitial, Title, NameSuffix, AddressLine1,

Re: Accountability with MySQL

2006-03-15 Thread James Harvard
At 7:28 pm +0100 14/3/06, Martijn Tonies wrote: Given that NULLs basically means the absence of a value (eg: unknown), you shouldn't be storing NULLs. At 1:49 pm -0500 14/3/06, Rhino wrote: A null means unknown or not applicable and is a perfectly valid value to use in many, many situations.

Re: Accountability with MySQL

2006-03-14 Thread Martijn Tonies
Hello Bruno, I am designing a simple accountability system so all the partners can have direct access to it by intranet. I was designing the data model, and came up with this: CREATE TABLE `moviments` ( `moviment_id` int(20) NOT NULL auto_increment, `moviment_date` date NOT NULL

Re: Accountability with MySQL

2006-03-14 Thread Bruno B B Magalháes
Hi Martijn, well about the date default value being invalid, well it´s working here in my system (MySQL 4.1.16, Mac OS X 10.4.5), and all my systens work with this... About the business logic I was thinking about showing the current month by default, and if the user wants he can select diferent

Re: Accountability with MySQL

2006-03-14 Thread SGreen
Bruno B B Magalháes [EMAIL PROTECTED] wrote on 03/14/2006 12:41:35 PM: I am designing a simple accountability system so all the partners can have direct access to it by intranet. I was designing the data model, and came up with this: CREATE TABLE `moviments` ( `moviment_id` int(20)

Re: Accountability with MySQL

2006-03-14 Thread Martijn Tonies
Hello Bruno, well about the date default value being invalid, well it´s working here in my system (MySQL 4.1.16, Mac OS X 10.4.5), and all my systens work with this... Yes, it's a valid value in MySQL, but it's an invalid date, that's what I'm trying to say. Why have an invalid date as the

Re: Accountability with MySQL

2006-03-14 Thread SGreen
Martijn Tonies [EMAIL PROTECTED] wrote on 03/14/2006 01:16:11 PM: Hello Bruno, well about the date default value being invalid, well it´s working here in my system (MySQL 4.1.16, Mac OS X 10.4.5), and all my systens work with this... Yes, it's a valid value in MySQL, but it's an

Re: Accountability with MySQL

2006-03-14 Thread Martijn Tonies
Should you have a flag for the status movement complete ? I would say yes but instead of a simple checkbox, you could store a date value. That gives you two pieces of information a) if the date is null then the movement is not complete. b) if the date is NOT null then the movement is complete and

Re: Accountability with MySQL

2006-03-14 Thread Rhino
- Original Message - From: Bruno B B Magalháes [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Tuesday, March 14, 2006 12:41 PM Subject: Accountability with MySQL I am designing a simple accountability system so all the partners can have direct access to it by intranet. I was

Re: Accountability with MySQL

2006-03-14 Thread Martijn Tonies
Hello Shawn, well about the date default value being invalid, well it´s working here in my system (MySQL 4.1.16, Mac OS X 10.4.5), and all my systens work with this... Yes, it's a valid value in MySQL, but it's an invalid date, that's what I'm trying to say. Why have an invalid date as

Re: Accountability with MySQL

2006-03-14 Thread Rhino
- Original Message - From: Martijn Tonies [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Tuesday, March 14, 2006 1:16 PM Subject: Re: Accountability with MySQL Hello Bruno, well about the date default value being invalid, well it´s working here in my system (MySQL 4.1.16, Mac

Re: Accountability with MySQL

2006-03-14 Thread Rhino
- Original Message - From: Martijn Tonies [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Tuesday, March 14, 2006 1:28 PM Subject: Re: Accountability with MySQL Should you have a flag for the status movement complete ? I would say yes but instead of a simple checkbox, you could

Re: Accountability with MySQL

2006-03-14 Thread Bruno B B Magalháes
I am designing a simple accountability system so all the partners can have direct access to it by intranet. I was designing the data model, and came up with this: CREATE TABLE `moviments` ( `moviment_id` int(20) NOT NULL auto_increment, `moviment_date` date NOT NULL default

Re: Accountability with MySQL

2006-03-14 Thread Martijn Tonies
Should you have a flag for the status movement complete ? I would say yes but instead of a simple checkbox, you could store a date value. That gives you two pieces of information a) if the date is null then the movement is not complete. b) if the date is NOT null then the movement is

Re: Accountability with MySQL

2006-03-14 Thread Rhino
- Original Message - From: Bruno B B Magalháes [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Tuesday, March 14, 2006 2:07 PM Subject: Re: Accountability with MySQL I am designing a simple accountability system so all the partners can have direct access to it by intranet. I

Re: Accountability with MySQL

2006-03-14 Thread Rhino
- Original Message - From: Martijn Tonies [EMAIL PROTECTED] To: Rhino [EMAIL PROTECTED]; mysql@lists.mysql.com Sent: Tuesday, March 14, 2006 2:16 PM Subject: Re: Accountability with MySQL Should you have a flag for the status movement complete ? I would say yes but instead

Re: Accountability with MySQL

2006-03-14 Thread James Harvard
At 7:48 pm -0500 14/3/06, Rhino wrote: Ah, so now things become clear, a NULL actually can mean two things? So much for clarity then... Come on; that's not fair. Unknown and not applicable are more like different senses of the same thing, not two opposite things. IIRC (but please don't ask for

Re: Accountability with MySQL

2006-03-14 Thread Martijn Tonies
At 7:48 pm -0500 14/3/06, Rhino wrote: Ah, so now things become clear, a NULL actually can mean two things? So much for clarity then... Come on; that's not fair. Unknown and not applicable are more like different senses of the same thing, not two opposite things. IIRC (but please don't

Re: Accountability with MySQL

2006-03-14 Thread Martijn Tonies
Basics of database design: store what you know. Given that NULLs basically means the absence of a value (eg: unknown), you shouldn't be storing NULLs. Nonsense!! That's a bold statement ... That's simply wrong. A null means unknown or not applicable and is a Ah, so now