<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>MySQL Forums - Database Design and Data Modelling</title>
        <description>Forum to discuss the important topic of proper schema design.</description>
        <link>http://forums.mysql.com/list.php?125</link>
        <lastBuildDate>Tue, 24 Nov 2009 20:26:23 +0000</lastBuildDate>
        <generator>Phorum 5.2.1-alpha</generator>
        <item>
            <guid>http://forums.mysql.com/read.php?125,292190,292190#msg-292190</guid>
            <title>Web App Database Design (no replies)</title>
            <link>http://forums.mysql.com/read.php?125,292190,292190#msg-292190</link>
            <description><![CDATA[ I am confused in how to setup an Internal/External Environment. We have a Windows 2003 Server box that has MySQL server running on it. Which in turn have 5 databases on it. One DB is used for Our Internal Application and other 4 are used for things like internal messenger/internal portal/bug tracking system etc. We recently got a new server which is strictly going to be an External Box and will have an external FTP/Email/SMTP Server/A new Web App to be built. <br />
<br />
My question is that is it a good idea to install another MySQL Server on this New External Box or just create another DB in the existing MySQL Server (Internal) and use that DB for External Web Application? What would be a good Practice in terms of Architecture? Another thing is that this &quot;Internal Database&quot; is being used in an Internal Application and eventually we would like Our Users in remote area to be able to go on new Web Application log in put there times/hours in and would like to integrate the data received from users with the internal application we are running. Of course, in future this Web App will most probably grow to something bigger.<br />
<br />
I can even create a Virtual Server on this new External box to install another MySQL Server and use this strictly for the External Web App, but I am not sure if that's a good way to go or not. Since we already have an Internal DB with lots of data.<br />
<br />
Please advice and thanks in advance!]]></description>
            <dc:creator>Nav Moud</dc:creator>
            <category>Database Design and Data Modelling</category>
            <pubDate>Fri, 20 Nov 2009 21:30:28 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?125,292071,292071#msg-292071</guid>
            <title>Mysql Experts Please suggest/comment on my DB design (no replies)</title>
            <link>http://forums.mysql.com/read.php?125,292071,292071#msg-292071</link>
            <description><![CDATA[ Hello,<br />
<br />
Ours is a java application which works with multiple vendors and their different services and needs weekly latest db updates from them. Means we upload the databases given by them on a weekly basis in to our db. At times these vendors change there table structures and in turn we  too modify our tables to accommodate the change and our code too. There are times when vendors go away and new vendors come in. As you can see that ours is a very volatile business. We used the exact table structure given by the vendors which was creating a mess/re-work every time. In order to avoid this we came up with dynamic structure.<br />
<br />
We created a <br />
1)vendor table<br />
2)Vendor services table<br />
3)Vendor and service mapping table.<br />
4)Store just all the vendors table names in one table.<br />
5)Store all vendors table columns in one table.<br />
6)Store all vendors column data in one table.<br />
<br />
So the columns became each row in this new design. Here are the tables.<br />
<br />
CREATE TABLE `third_party_vendors` (<br />
  `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,<br />
  `name` varchar(30) NOT NULL DEFAULT '',<br />
  PRIMARY KEY (`id`)<br />
) ENGINE=InnoDB;<br />
<br />
 CREATE TABLE `third_party_vendor_service_type` (<br />
  `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,<br />
  `name` varchar(40) NOT NULL,<br />
  PRIMARY KEY (`id`)<br />
) ENGINE=InnoDB<br />
<br />
CREATE TABLE `vendor_service_mapping` (<br />
  `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,<br />
  `third_party_vendors_id` smallint(5) unsigned NOT NULL DEFAULT '0',<br />
  `third_party_vendor_service_type_id` tinyint(3) unsigned NOT NULL DEFAULT '0',<br />
  PRIMARY KEY (`id`),<br />
  KEY `fk_third_party_vendors_id` (`third_party_vendors_id`),<br />
  KEY `fk_third_party_vendor_service_type_id` (`third_party_vendor_service_type_id`),<br />
  CONSTRAINT `vendor_service_mapping_ibfk_1` FOREIGN KEY (`third_party_vendors_id`) REFERENCES `third_party_vendors` (`id`),<br />
  CONSTRAINT `vendor_service_mapping_ibfk_2` FOREIGN KEY (`third_party_vendor_service_type_id`) REFERENCES `third_party_vendor_service_type` (`id`)<br />
) ENGINE=InnoDB;<br />
<br />
CREATE TABLE `virtual_table_name` (<br />
  `id` tinyint(2) unsigned NOT NULL AUTO_INCREMENT,<br />
  `table_name` varchar(20) NOT NULL,<br />
  PRIMARY KEY (`id`)<br />
) ENGINE=InnoDB;<br />
<br />
CREATE TABLE `virtual_column_name` (<br />
  `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,<br />
  `virtual_table_name_id` tinyint(2) unsigned NOT NULL,<br />
  `vendor_service_mapping_id` smallint(5) unsigned NOT NULL,<br />
  `column_name` varchar(30) NOT NULL,<br />
  PRIMARY KEY (`id`),<br />
  KEY `fk_virtual_table_name_id` (`virtual_table_name_id`),<br />
  KEY `fk_vendor_service_mapping_id` (`vendor_service_mapping_id`),<br />
  CONSTRAINT `virtual_column_name_ibfk_1` FOREIGN KEY (`virtual_table_name_id`) REFERENCES `virtual_table_name` (`id`),<br />
  CONSTRAINT `virtual_column_name_ibfk_2` FOREIGN KEY (`vendor_service_mapping_id`) REFERENCES `vendor_service_mapping` (`id`)<br />
) ENGINE=InnoDB;<br />
<br />
CREATE TABLE `virtual_column_data` (<br />
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,<br />
  `virtual_column_name_id` smallint(5) unsigned NOT NULL,<br />
  `data` tinytext,<br />
  PRIMARY KEY (`id`),<br />
  KEY `fk_virtual_column_name_id` (`virtual_column_name_id`),<br />
  CONSTRAINT `virtual_column_data_ibfk_1` FOREIGN KEY (`virtual_column_name_id`) REFERENCES `virtual_column_name` (`id`)<br />
) ENGINE=InnoDB;<br />
<br />
I hope you must have got a picture what i am trying to do. The virtual_column_data will hold a every vendors column data and each column data becomes a single row.<br />
<br />
Advantages<br />
-----------<br />
1) I dont have to change the my code or db structure<br />
2) Irrespective of any vendor table structure changes or any vendor leaving or coming in. there will not be any profound change.<br />
3) As this table grows over a period of time i am planning on apply partitioning on the last table.(i know partitioning does not support foreign key, but got a work around that too).<br />
<br />
I want mysql experts to please guide me or suggest is my approach correct or not.What are the various draw backs to this approach. Or Is this approach at least  practical in nature in long term perspective... <br />
<br />
Thanks]]></description>
            <dc:creator>Wane cooper</dc:creator>
            <category>Database Design and Data Modelling</category>
            <pubDate>Fri, 20 Nov 2009 06:38:49 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?125,291918,291918#msg-291918</guid>
            <title>Book on Database design (no replies)</title>
            <link>http://forums.mysql.com/read.php?125,291918,291918#msg-291918</link>
            <description><![CDATA[ Hi,<br />
<br />
I am new to web development and satrted working on a project in php-MySql, could someone suggest a good book on Database Design.<br />
<br />
Regards<br />
Ankur]]></description>
            <dc:creator>Ankur grover</dc:creator>
            <category>Database Design and Data Modelling</category>
            <pubDate>Thu, 19 Nov 2009 09:18:37 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?125,291178,291178#msg-291178</guid>
            <title>Can this query be improved ? (1 reply)</title>
            <link>http://forums.mysql.com/read.php?125,291178,291178#msg-291178</link>
            <description><![CDATA[ I have the following database structure:<br />
<br />
CREATE TABLE IF NOT EXISTS `dailydak` (<br />
  `DAK_ID` int(10) NOT NULL auto_increment,<br />
  `REC_DATE` date default '0000-00-00',<br />
  `DAK_TYPE_ID` int(11) NOT NULL,<br />
  `DAIRY_NO` varchar(20) NOT NULL,<br />
  `DAK_FROM` varchar(50) default NULL,<br />
  `SUBJECT` varchar(255) default '',<br />
  `PresidentsRemarks` varchar(255) default NULL,<br />
  `ENTRY_U_N` varchar(15) default NULL,<br />
  `ENTRY_DATE` date default '0000-00-00',<br />
  `DEP_CODE_FROM` varchar(2) default '',<br />
  `DEP_CODE_TO` varchar(2) default NULL,<br />
  `ACTION_TAKEN_1` varchar(255) default NULL,<br />
  `ACTION_TAKEN_DATE_1` date default '0000-00-00',<br />
  `ACTION_TAKEN_U_N_1` varchar(15) default NULL,<br />
  `ACTION_TAKEN_2` varchar(255) default NULL,<br />
  `ACTION_TAKEN_DATE_2` date default '0000-00-00',<br />
  `ACTION_TAKEN_U_N_2` varchar(15) default NULL,<br />
  PRIMARY KEY  (`DAK_ID`)<br />
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=23 ;<br />
<br />
-- --------------------------------------------------------<br />
<br />
--<br />
-- Table structure for table `dak_types`<br />
--<br />
<br />
CREATE TABLE IF NOT EXISTS `dak_types` (<br />
  `type_id` int(11) NOT NULL auto_increment,<br />
  `dak_type`<a rel="nofollow"  href="http://202.59.74.108/phpmyadmin/index.php?db=lccidak&amp;token=5df78c2b99f20c2d536cd6132cabe3b6">http://202.59.74.108/phpmyadmin/index.php?db=lccidak&amp;token=5df78c2b99f20c2d536cd6132cabe3b6</a> varchar(24) NOT NULL,<br />
  PRIMARY KEY  (`type_id`)<br />
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COMMENT='hold the types of dak received' AUTO_INCREMENT=5 ;<br />
<br />
-- --------------------------------------------------------<br />
<br />
--<br />
-- Table structure for table `department`<br />
--<br />
<br />
CREATE TABLE IF NOT EXISTS `department` (<br />
  `DEP_CODE` varchar(2) default '',<br />
  `DEP_NAME` varchar(40) default NULL,<br />
  `PK_ID` int(12) NOT NULL auto_increment,<br />
  PRIMARY KEY  (`PK_ID`),<br />
  UNIQUE KEY `PK_dep_file` (`DEP_CODE`)<br />
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=14 ;<br />
<br />
-- --------------------------------------------------------<br />
<br />
--<br />
-- Table structure for table `users`<br />
--<br />
<br />
CREATE TABLE IF NOT EXISTS `users` (<br />
  `USERID` int(10) NOT NULL auto_increment,<br />
  `U_N` varchar(15) default NULL,<br />
  `PASS` varchar(40) NOT NULL,<br />
  `ADMIN_STATE` char(1) default '3',<br />
  `USER_PERMISSIONS` text,<br />
  `DEP_CODE` varchar(2) default NULL,<br />
  PRIMARY KEY  (`USERID`)<br />
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=76 ;<br />
<br />
<br />
I need to improve the following query:<br />
<br />
SELECT M.rec_date, M.dak_type, M.dairy_no, M.subject, M.dep_name_from, DP.DEP_NAME as<br />
dep_name_to, M.entry_u_n, M.entry_date,<br />
M.action_taken_1, M.action_taken_date_1, M.action_taken_u_n_1, <br />
M.action_taken_2, M.action_taken_date_2, M.action_taken_u_n_2 FROM <br />
(<br />
SELECT d.rec_date, dt.dak_type, d.dairy_no, d.subject, d.dep_code_from,dep.DEP_NAME as dep_name_from,<br />
d.dep_code_to,'' as dep_name_to, d.entry_u_n, d.entry_date,<br />
d.action_taken_1, d.action_taken_date_1, d.action_taken_u_n_1, <br />
d.action_taken_2, d.action_taken_date_2, d.action_taken_u_n_2<br />
FROM dailydak d, department dep, dak_types dt<br />
WHERE (d.dep_code_from=dep.DEP_CODE) and (d.dak_type_id = dt.type_id)<br />
)<br />
M , department DP WHERE M.dep_code_to=DP.DEP_CODE<br />
<br />
How can I improve the performance of this query ?<br />
<br />
Thank you<br />
<br />
Qamar,]]></description>
            <dc:creator>Qamar Ali</dc:creator>
            <category>Database Design and Data Modelling</category>
            <pubDate>Wed, 18 Nov 2009 23:04:48 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?125,290942,290942#msg-290942</guid>
            <title>Engines, Fulltext Indexes, Transactions? (1 reply)</title>
            <link>http://forums.mysql.com/read.php?125,290942,290942#msg-290942</link>
            <description><![CDATA[ I'm in the process of designing a database that should be able to incorporate fulltext searches. When inserting information into the database it is of absolute importance that all queries execute or none at all. This needs to make use of transactions. If I use the myIsam engine which supports fulltext indexes, I cannot perform transactions. Also if I use the InnoDB engine i'm unable to perform fulltext searches. Any suggestions? Workarounds?]]></description>
            <dc:creator>Remington Seph</dc:creator>
            <category>Database Design and Data Modelling</category>
            <pubDate>Thu, 19 Nov 2009 01:05:48 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?125,289978,289978#msg-289978</guid>
            <title>Combining multiple tables by date/time (1 reply)</title>
            <link>http://forums.mysql.com/read.php?125,289978,289978#msg-289978</link>
            <description><![CDATA[ Hi all,<br />
<br />
Full disclosure, I'm not actually doing this in MySQL, but I couldn't find any general database modeling forums and I need help. :)<br />
<br />
I am trying to model a database containing information about events from different sources.  All of these tables have date and time (DATETIME and INT respectively), and I've added an integer primary key to each table.<br />
<br />
To make it a bit more concrete, say for example table1 and table2 look like<br />
<br />
PKEY, DATE, TIME, DESCRIPTION<br />
PKEY, DATE, TIME, CATEGORY, LOCATION, etc.<br />
<br />
The desired end state is a query which produces<br />
<br />
DATE, TIME, DESCRIPTION, CATEGORY, LOCATION, etc.<br />
<br />
Which contains all records in both tables (my real model currently has 4 tables).  Currently the way that I'm doing it is by having an additional table in the form<br />
<br />
PKEY, DATE, TIME, table1ID, table2ID<br />
<br />
Which I populate with the key of the appropriate table in the appropriate field and then join.<br />
<br />
The biggest issue I have with this approach is that each change I make to table1 or table2 requires me to make an appropriate change in the additional table.  If possible I'd like to do this through modeling instead.  Secondarily, I imagine that as I add sources that the performance of this will be close to O(N^2).<br />
<br />
Does anyone have any suggestions on how to improve this scenario?  I'm quite a bit rusty on SQL, but I don't recall an easy way to do this.  Theory rather than actual code is most appreciated, but any suggestions I'll make work.<br />
<br />
Thanks in advance,<br />
<br />
Dion]]></description>
            <dc:creator>Dion Houston Sr</dc:creator>
            <category>Database Design and Data Modelling</category>
            <pubDate>Sun, 08 Nov 2009 04:06:56 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?125,289608,289608#msg-289608</guid>
            <title>need help with DataBase Normalization (1 reply)</title>
            <link>http://forums.mysql.com/read.php?125,289608,289608#msg-289608</link>
            <description><![CDATA[ Hello. I have to normalize a tables in database, I would like to ask anyone experienced with databased if below normalization is correct for 1F,2F,3F. thanks for reply<br />
<br />
Normalization<br />
<br />
Cooking( rID, rname, ( ingredientID, ingredientName, amount), cookID, cookName, cookPhNumber);<br />
<br />
cookID -&gt; cookName<br />
cookID -&gt; cookPhNumber<br />
?rID -&gt; rname<br />
?rID -&gt; cookID<br />
?ingredientID -&gt; ingredientName<br />
<br />
1NF:<br />
<br />
RECIPE:<br />
rID – primary key<br />
 rName<br />
<br />
INGREDIENT:<br />
ingredientID – primary key<br />
ingredientName<br />
amount<br />
<br />
COOK<br />
cookID – primary key<br />
cookName<br />
cookPhNumber<br />
<br />
I created separate table for each group of related data and identified each row with unique data – primary key.<br />
<br />
2NF:<br />
<br />
RECIPE<br />
rID – primary key<br />
rname<br />
<br />
INGREDIENT<br />
ingredientID – primary key<br />
ingredientName<br />
amount<br />
<br />
COOK<br />
cookID – primary key<br />
cookName<br />
<br />
COOKPH<br />
cookID – primary key<br />
cookPhNumber<br />
<br />
3NF:<br />
<br />
RECIPE<br />
rID – primary key<br />
rname<br />
<br />
INGREDIENT<br />
ingredientID – primary key<br />
ingredientName<br />
amount<br />
<br />
COOK<br />
cookID – primary key<br />
cookName<br />
<br />
COOKPH<br />
cookID – primary key<br />
cookPhNumber<br />
<br />
COOKRECIPE<br />
cookID – primary key<br />
rID]]></description>
            <dc:creator>piotr motyl</dc:creator>
            <category>Database Design and Data Modelling</category>
            <pubDate>Fri, 06 Nov 2009 05:11:52 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?125,289214,289214#msg-289214</guid>
            <title>Urgen query help needed (1 reply)</title>
            <link>http://forums.mysql.com/read.php?125,289214,289214#msg-289214</link>
            <description><![CDATA[ Hi there,<br />
<br />
My knowledge in MySQL is pretty basic and i hit a dead-end on one of my projects that is due tomorrow.<br />
<br />
I have a table that stores all menu items that looks like below:<br />
----------------------<br />
|    CATEGORIES      |<br />
----------------------<br />
ID | sub_ID | name   |<br />
 1 | 0      | name1  |<br />
 2 | 0      | name2  |<br />
 3 | 0      | name3  |<br />
 4 | 1      | name1-1|<br />
 5 | 1      | name1-2|<br />
 6 | 1      | name1-3|<br />
 7 | 2      | name2-1|<br />
 8 | 2      | name2-2|<br />
 9 | 3      | name3-1|<br />
----------------------<br />
<br />
And I also have a table that stores items that go under IDs of the table above:<br />
------------------------<br />
|      ITEMS           |<br />
------------------------<br />
ID | cat | itemName    |<br />
 1 | 4   | Stringvalue |<br />
 2 | 4   | Stringvalue |<br />
 3 | 4   | Stringvalue |<br />
 4 | 4   | Stringvalue |<br />
 5 | 5   | Stringvalue |<br />
 6 | 5   | Stringvalue |<br />
 7 | 5   | Stringvalue |<br />
 8 | 6   | Stringvalue |<br />
 9 | 6   | Stringvalue |<br />
10 | 5   | Stringvalue |<br />
11 | 5   | Stringvalue |<br />
12 | 4   | Stringvalue |<br />
13 | 4   | Stringvalue |<br />
14 | 4   | Stringvalue |<br />
------------------------<br />
<br />
My question is how do I get the values with cat=4 from the table above when all i have is value 1 from the first table?<br />
<br />
In other words, with value `1`, i want the query to first get the ID values on sub_ID=1 and use those ID values to get the records from the second table on cat='whatever those ID values are'..? make sense? PLZ HELP<br />
<br />
Any comments and suggestions are greatly appreciated!<br />
<br />
Thanks!]]></description>
            <dc:creator>Eric Hadson</dc:creator>
            <category>Database Design and Data Modelling</category>
            <pubDate>Wed, 04 Nov 2009 21:54:26 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?125,287784,287784#msg-287784</guid>
            <title>Data modeling techniques and resources (1 reply)</title>
            <link>http://forums.mysql.com/read.php?125,287784,287784#msg-287784</link>
            <description><![CDATA[ Hi All,<br />
<br />
I'm currently working on a thesis for my masters which is investigating 3D data modeling. At the moment I'm just trying to create a concise set of resources before starting my literary review and want to make sure that my facts aren't dated. I was wondering if anyone could offer any advice on good modern data modeling resources. Basically I'm looking for info on data modeling techniques - their similarities and differences and how data modeling has evolved since the theory was adapted in the 70s. Also what works in modern data modeling and what are are the drawbacks. A lot of articles and books I have found seem to be from the late 90s, early 2000s which do seem to be a bit dated? Thanks in advance for your time - any advice or help you could give me really would be greatly appreciated.<br />
<br />
Derm]]></description>
            <dc:creator>Dermot Duncan</dc:creator>
            <category>Database Design and Data Modelling</category>
            <pubDate>Sun, 25 Oct 2009 18:41:12 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?125,287739,287739#msg-287739</guid>
            <title>Large table designissue (7 replies)</title>
            <link>http://forums.mysql.com/read.php?125,287739,287739#msg-287739</link>
            <description><![CDATA[ I have a table growing immensely every day , currently it has around 18777410 records.<br />
Our site is available 24x7 and we are using mysql replication to distrubute load on the database server ( a master and single slave combination).<br />
It is almost two years we running the application on mysql 5.0.45 everything seems to fine, but now we are facing problem with maintaining this huge table.<br />
Following are key problem areas:<br />
	a) Running aggregate queries takes more than 5 minutes, which is not acceptable with respect to site performane<br />
	b) Adding index is not possible as it takes more than 3/4 hours which result in site downtime<br />
	c) command like optimize and analyze cant be run as it is online application and it will result in locking of this important table.<br />
<br />
<br />
Can any one suggest possible approach to solve this problem, we are thinking of trying following approach<br />
	a) Have seperate table for having archive data,so query requiring complete data, will need to be fire two queries or have union on archive data and live data<br />
	b) Upgrade to mysql 5.1 and see having partitioning on this table helps<br />
	c) have mutliple database slave server to hit queries on most used use cases on this table.<br />
<br />
Let me know if anyone faced similar problem and how to go about solving it]]></description>
            <dc:creator>omkar prabhu</dc:creator>
            <category>Database Design and Data Modelling</category>
            <pubDate>Thu, 19 Nov 2009 18:55:16 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?125,287643,287643#msg-287643</guid>
            <title>Data Modelling for an email table (4 replies)</title>
            <link>http://forums.mysql.com/read.php?125,287643,287643#msg-287643</link>
            <description><![CDATA[ Hi All,<br />
<br />
 I have a table in my database, which is basically a maillog ... ie:<br />
<br />
ID, Timestamp (int), From (varchar), To (varchar), error<br />
<br />
 Currently has 2.1 million rows, but I need to potentially double/triple this. <br />
<br />
 The server itself is being upgraded within the next few weeks, to a 10K RPM, RAID 5, 8 Gig machine, but I`m really looking for some ideas on how to improve the efficency as right now even inserts are taking 5-10 seconds to execute.<br />
<br />
 I have indexes on timestamp, from and to .. based on lookups the user will perform (which are unfortunately any string in the address). <br />
<br />
 I've thought about normalizing down by splitting the addresses into from/to but this brings in complexities into the logging application. <br />
<br />
 Recipient uniqueness is pretty high, but at least count From was around 1.4 million unique addresses.<br />
<br />
 Could any guru's suggest an alternative way to approach this ? POssibly a stored procedure to auto-split the sender etc thus bring down the number of entries in the index ?<br />
<br />
 Failing that is there a better indexing method for this type of data.<br />
<br />
 Any thoughts would be greatly appreciated<br />
<br />
Cheers<br />
<br />
Chris]]></description>
            <dc:creator>Chris Russell</dc:creator>
            <category>Database Design and Data Modelling</category>
            <pubDate>Wed, 18 Nov 2009 06:02:45 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?125,287490,287490#msg-287490</guid>
            <title>calculate variable between two times (no replies)</title>
            <link>http://forums.mysql.com/read.php?125,287490,287490#msg-287490</link>
            <description><![CDATA[ my file to calculate is<br />
date            time            temp  <br />
2008-12-01 	00:01:00 	10.2 	-9999 	-9999 	10.45 	10.3 	10 	<br />
2008-12-01 	00:02:00 	10.233 	-9999 	-9999 	10.5 	10.3 	10 	<br />
2008-12-01 	00:03:00 	10.317 	-9999 	-9999	10.2    10.1    10.2<br />
2008-12-01 	00:04:00 	10.467 	-9999 	-9999 	10.5 	10.3 	10.1 	<br />
2008-12-01 	00:05:00 	10.517 	-9999 	-9999 	10.5	10.5   		2008-12-01 	00:06:00 	10.65 	-9999 	-9999 	10.6 	10.4 	10.217 <br />
......<br />
2008-12-31      00:59:00        10.314   -9999	<br />
i want to calculate maxi of temp betwenn two times<br />
prog:<br />
for($jour= $jourdebut; $jour &lt;=  $jourfin ; $jour++)<br />
 {<br />
SELECT date, HEURE, maxi(temp) FROM tt1208 WHERE HEURE BETWEEN '06:01:00' AND '06:00:00' AND date = '$jour' GROUP BY date;<br />
<br />
result NULL<br />
}<br />
please help me!!!]]></description>
            <dc:creator>akerou wassim</dc:creator>
            <category>Database Design and Data Modelling</category>
            <pubDate>Thu, 22 Oct 2009 16:20:01 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?125,286878,286878#msg-286878</guid>
            <title>Join or subquery for repeating data item (1 reply)</title>
            <link>http://forums.mysql.com/read.php?125,286878,286878#msg-286878</link>
            <description><![CDATA[ Hi, we're struggling to write a query in a simple booking system that has repeating dates. <br />
<br />
The tables involved are<br />
Booking table:<br />
booking_id<br />
date<br />
time<br />
location<br />
who_with<br />
fee... etc<br />
<br />
Dates table:<br />
booking_id<br />
date<br />
<br />
We need to find bookings within a date range, plus who_with and location, and return all fields in the booking. I've read up about joins and subqueries but still can't figure it out.<br />
<br />
Thanks in advance for any suggestions]]></description>
            <dc:creator>Adrian Cole</dc:creator>
            <category>Database Design and Data Modelling</category>
            <pubDate>Wed, 21 Oct 2009 00:32:43 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?125,286638,286638#msg-286638</guid>
            <title>real client's project...please help in optimizing design!! (1 reply)</title>
            <link>http://forums.mysql.com/read.php?125,286638,286638#msg-286638</link>
            <description><![CDATA[ Right, I poster earlier with a practice table I was working on. I appreciated the reply and have been working on that.. but yesterday I got a real client's project.<br />
<br />
I have been given the task of optimizing the database design. <br />
The database keeps track of the transactions the company makes. A transaction is made and records are stored in several different tables.<br />
<br />
<br />
These are the tables:<br />
<br />
Ledger<br />
Group <br />
User <br />
Opening Balance<br />
Transaction<br />
Transaction Type<br />
<br />
<br />
<br />
 The client would like <br />
<br />
1) the data to be stored in ONE location and not 2 different places<br />
<br />
2) to save disk space<br />
<br />
3) prevent duplicate entries being <br />
<br />
<br />
Any ideaS? I wont post the current design of the database unless necessary as I would like to try and do it all by myself but some pointers would be appreciated.<br />
<br />
Initially I was thinking of denormalization. Eradicating the multiple tables and placing all data in one table. But this might not be the best strategy. How would you do it? What practices would you use?<br />
<br />
ANY help would be appreciated. <br />
<br />
Thanks!!]]></description>
            <dc:creator>Ajeet Chadha</dc:creator>
            <category>Database Design and Data Modelling</category>
            <pubDate>Sun, 18 Oct 2009 17:01:50 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?125,286551,286551#msg-286551</guid>
            <title>Designing a Normalized Database (1 reply)</title>
            <link>http://forums.mysql.com/read.php?125,286551,286551#msg-286551</link>
            <description><![CDATA[ I am in a fix on how to crack this database design nut. I believe that all you coders are gonna love this.<br />
<br />
I have a class of students whose grades are to be recorded. There are 52 distinct types of grades that a single student can get. A single student can get plural types of grades. Also a student can get same type of grade multiple number of times or not receive any grades at all. Consider the following sample:<br />
<br />
Student A gets Type I Grade 3 times, Type II Grade 1 time<br />
Student B gets No Grade at all<br />
Student C gets Type II Grade twice, Type XII Grade 5 times<br />
etc, and so forth<br />
<br />
I have a report based on grades to be displayed by querying this database, example report may be:<br />
<br />
Names of students that received no grade at all<br />
Names of students that received Type II Grade once<br />
Names of students that received Type VI Grade more than once<br />
etc and so forth<br />
<br />
What are your suggestions??]]></description>
            <dc:creator>Gautam Kumar</dc:creator>
            <category>Database Design and Data Modelling</category>
            <pubDate>Sun, 18 Oct 2009 03:46:52 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?125,286039,286039#msg-286039</guid>
            <title>Is this database structure correct? Please help oh wise ones :) (2 replies)</title>
            <link>http://forums.mysql.com/read.php?125,286039,286039#msg-286039</link>
            <description><![CDATA[ I am fairly new to mysql and wanted to practice making a database and tables. As well as filling the tables with made up data and then practicing queries. I wanted to emulate a real life database project. <br />
<br />
So I decided to make a database for a Car Dealership. <br />
<br />
the database consists of three tables...Car...Buyer..Repairs. The structure is displayed below. <br />
<br />
<br />
CAR table - <br />
<br />
car_id int(5) primary key <br />
make varchar(15) <br />
model varchar(15) <br />
year int(4) <br />
origin varchar(15) <br />
buyer int(5) foreign key references buyer_id in the BUYER table <br />
cost double(5,2) <br />
<br />
<br />
<br />
BUYER table - <br />
<br />
buyer_id int(5) primary key <br />
name varchar(20) <br />
address varchar(20) <br />
tel int(10) <br />
car_id int(5) foreign key references car_id in the CAR table <br />
<br />
<br />
REPAIRS table- <br />
<br />
part_id int(5) primary key <br />
origin varchar(15) <br />
cost double(5,2) <br />
car_id int(5) foreign key references car_id in the CAR table <br />
<br />
<br />
<br />
<br />
Do you see any problems in this structure? <br />
anything I should have done differently? <br />
anything I could do to improve database performance? <br />
<br />
Please bare with me as I am new to this and wish to be a DBA one day soon! <br />
<br />
All comments will be appreciated!! <br />
<br />
Thanks people]]></description>
            <dc:creator>Ajeet Chadha</dc:creator>
            <category>Database Design and Data Modelling</category>
            <pubDate>Fri, 16 Oct 2009 05:53:12 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?125,284960,284960#msg-284960</guid>
            <title>How to index this table? (5 replies)</title>
            <link>http://forums.mysql.com/read.php?125,284960,284960#msg-284960</link>
            <description><![CDATA[ Hi,<br />
<br />
I have a table that stores article views per day per article:<br />
<br />
  `post_id` int(11) NOT NULL,<br />
  `date` date NOT NULL,<br />
  `views` int(11) NOT NULL<br />
<br />
A couple of entries:<br />
1987 	2009-10-04 	1744<br />
1583 	2009-10-04 	2626<br />
1238 	2009-10-04 	2211<br />
<br />
This works fine - but I am now trying to figure out whats the best way to add an index to this so that if I am running a query limiting between dates I dont have to run through all the hundreds of thousands of records to find a couple hundred results.<br />
<br />
my query looks something like this (for 7 days top articles):<br />
SELECT articles.*, sum(views) AS views FROM articles LEFT JOIN article_views ON article_views.article_id = articles.id WHERE ( date &lt;= '2009-10-07' AND date &gt;= '2009-10-01') GROUP BY article_id<br />
<br />
Any help would be greatly appreciated.<br />
<br />
Thanks<br />
Ian]]></description>
            <dc:creator>Ian Barnes</dc:creator>
            <category>Database Design and Data Modelling</category>
            <pubDate>Mon, 12 Oct 2009 06:46:38 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?125,284822,284822#msg-284822</guid>
            <title>ok for import data (no replies)</title>
            <link>http://forums.mysql.com/read.php?125,284822,284822#msg-284822</link>
            <description><![CDATA[ thank you very much for your advice I finally managed to import my data Climate minute basis by applying the attempted DATETIME column is the only way to import my data.<br />
greetings<br />
<br />
m.mezred]]></description>
            <dc:creator>akerou wassim</dc:creator>
            <category>Database Design and Data Modelling</category>
            <pubDate>Tue, 06 Oct 2009 13:00:45 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?125,284489,284489#msg-284489</guid>
            <title>Problem with Database Design (1 reply)</title>
            <link>http://forums.mysql.com/read.php?125,284489,284489#msg-284489</link>
            <description><![CDATA[ Hi!<br />
<br />
I am a student and I am working on database that concerns customer-order-product relationship. When designing it I encountered an issue that I do not really know how to solve it in the way it seems reasonable and obeys Normalization process. I would appreciate for any assistance.<br />
<br />
Description of my problem:<br />
We have product for instance T-shirt that can have different sizes and colors and each of this specific combination has quantity (http://img251.imageshack.us/img251/8871/products.jpg)<br />
Next I created relation between Orders and Products as many-to-many (http://img406.imageshack.us/img406/8471/orderdetails.jpg). And here problems starts… In Order_Details table if someone order 5x of T-shirt with size S and color blue, and then 3x of the same T-shirt but with M size I will have repeated some values. Another thing is that Size and Color attributes rely only only on ProductFK Key and not the whole Key (OrderFK-ProductFK) so I moved these details to another table like here(http://img18.imageshack.us/img18/3507/productorderdetails.jpg), but now arise another problem Quantity attribute… in my it should be placed in Order_Details, right ? The thing is now I ended up with basically the same table like Product_Size_Color (http://img251.imageshack.us/img251/8871/products.jpg) but without Quantity attribute which we do not need here since I assume it should be in Order_Details table. How I can combine it altogether to get consistent database ?<br />
<br />
Whole database until now looks like this (http://img18.imageshack.us/img18/8130/wholedatabase.jpg)<br />
If there is anything else that in Your opinion is bad please let me know.]]></description>
            <dc:creator>aaa aaa</dc:creator>
            <category>Database Design and Data Modelling</category>
            <pubDate>Mon, 05 Oct 2009 01:57:17 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?125,284087,284087#msg-284087</guid>
            <title>Using null to mean all or any (7 replies)</title>
            <link>http://forums.mysql.com/read.php?125,284087,284087#msg-284087</link>
            <description><![CDATA[ I am new to MySQL and I am trying to determine how to handle a situation where I have a foreign key but I want to have a hierarchy and have a meaning of ALL or ANY.<br />
<br />
These easiest way to describe it is with an example.<br />
<br />
I have a customer table with many customers.<br />
I have a rate table with many rates.<br />
I want to set up a rate of $100.00 that applies to all of my customers.<br />
I then need a rate of $90.00 that applies to only one customer, Customer A.<br />
If I am searching for the correct rate for Customer A I should find the row with the $90.00 rate.<br />
If I search for a rate for any other customer I should find the rate of $100.00.<br />
<br />
My instinct is to have a customer foreign key on the rate table that would have Customer A's key on the $90.00 rate and a null value on the $100.00 rate.<br />
The query would be: Select amount from Rate where rate.customer is &quot;Customer A&quot; or rate.customer is null.<br />
<br />
This works but I am concerned with efficiency and with having correct database design.  I am not arguing in favor of this solution I am merely trying to find out if it is a valid design or if there are other solutions for this scenario.<br />
<br />
I would appreciate any suggestions.]]></description>
            <dc:creator>Jim Haberlin</dc:creator>
            <category>Database Design and Data Modelling</category>
            <pubDate>Fri, 02 Oct 2009 20:48:58 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?125,283946,283946#msg-283946</guid>
            <title>Distributed database creation (1 reply)</title>
            <link>http://forums.mysql.com/read.php?125,283946,283946#msg-283946</link>
            <description><![CDATA[ HI<br />
<br />
<br />
I want to create a distributed database.<br />
the structure of database is same on all the servers, only the contents are different.<br />
<br />
How should i create this kind of distributed database...<br />
What are the necessary implementation steps fot doin this<br />
<br />
<br />
Thnx <br />
Amit.]]></description>
            <dc:creator>Amit Rane</dc:creator>
            <category>Database Design and Data Modelling</category>
            <pubDate>Thu, 01 Oct 2009 14:13:35 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?125,283544,283544#msg-283544</guid>
            <title>Basic Primary key syntax (3 replies)</title>
            <link>http://forums.mysql.com/read.php?125,283544,283544#msg-283544</link>
            <description><![CDATA[ I have a table with data about organizations. Each row represents a quarterly report filed by an organization; an organization files many reports over time and thus generate multiple rows.  One column is an OrgID number that uniquely identifies each organization.    OrgID also appears in another table of people that donate to the different organizations. I want to make OrgID in the donations table a foreign key referring to OrgID in the organizations table as the primary key.  But there will be multiple entries for a given OrgID in the organizations table.  What's the way around this?<br />
<br />
Thanks!]]></description>
            <dc:creator>BW Bloch</dc:creator>
            <category>Database Design and Data Modelling</category>
            <pubDate>Wed, 30 Sep 2009 04:47:23 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?125,283400,283400#msg-283400</guid>
            <title>Help storing time in database table (1 reply)</title>
            <link>http://forums.mysql.com/read.php?125,283400,283400#msg-283400</link>
            <description><![CDATA[ Hi Guys,<br />
<br />
<br />
	I am new to mysql, I am creating a database where in one of the tables I need to store just the time<br />
	not the date value. So I need to store just &quot;23:12:04&quot; and frequently a search will be applied to the feild.<br />
	<br />
	Can anyone suggest a best way to store the time in table which also has good performance on search.<br />
<br />
Thanks]]></description>
            <dc:creator>Aadlene Wesley</dc:creator>
            <category>Database Design and Data Modelling</category>
            <pubDate>Mon, 28 Sep 2009 00:05:07 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?125,281887,281887#msg-281887</guid>
            <title>How to import data from Multiple servers using federated engine (6 replies)</title>
            <link>http://forums.mysql.com/read.php?125,281887,281887#msg-281887</link>
            <description><![CDATA[ Hi all, <br />
<br />
I wish to import data from multiple servers onto a single local machine using a federated engine. <br />
<br />
the data is distributed on multiple servers where the database structure is same <br />
only the table contents are different. <br />
eg: <br />
<br />
Server1: <br />
<br />
table name question. <br />
<br />
id........type <br />
_________________<br />
1 ........easy <br />
2 ........medium <br />
3 ........hard <br />
<br />
<br />
<br />
Server2: <br />
<br />
table name question. <br />
<br />
id........type <br />
_________________<br />
4 ........easy <br />
5 ........medium <br />
6 ........hard <br />
<br />
<br />
now the above two tables are on different servers. <br />
I want to import data from both these tables using single federated table <br />
and show the output as follows on a client machine. <br />
<br />
Client: <br />
<br />
table name question. <br />
<br />
id type <br />
________________ <br />
1 easy <br />
2 medium <br />
3 hard <br />
4 easy <br />
5 medium <br />
6 hard <br />
<br />
<br />
please i need it urgently. <br />
<br />
thanx in advance <br />
<br />
Amit.]]></description>
            <dc:creator>Amit Rane</dc:creator>
            <category>Database Design and Data Modelling</category>
            <pubDate>Thu, 24 Sep 2009 06:16:59 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?125,281886,281886#msg-281886</guid>
            <title>How to import data from Multiple servers using federated engine (no replies)</title>
            <link>http://forums.mysql.com/read.php?125,281886,281886#msg-281886</link>
            <description><![CDATA[ Hi all,<br />
<br />
I wish to import data from multiple servers onto a single local machine using a federated engine.<br />
<br />
the data is distributed on multiple servers where the database structure is same<br />
only the table contents are different.<br />
eg:<br />
<br />
Server1:                       Server2:<br />
<br />
table name question.           table name question<br />
<br />
id     type                    id        type<br />
_________________              ______________<br />
1      easy                    4         easy<br />
2      medium                  5         medium<br />
3      hard                    6         hard<br />
<br />
<br />
now the above two tables are on different servers.<br />
I want to import data from both these tables using single federated table<br />
and show the output as follows on a client machine.<br />
<br />
Client:<br />
<br />
table name question.<br />
<br />
id     type  <br />
________________<br />
1      easy                    <br />
2      medium                  <br />
3      hard    <br />
4      easy<br />
5      medium<br />
6      hard<br />
<br />
<br />
please i need it urgently.<br />
<br />
thanx in advance <br />
<br />
Amit.]]></description>
            <dc:creator>Amit Rane</dc:creator>
            <category>Database Design and Data Modelling</category>
            <pubDate>Fri, 18 Sep 2009 09:31:29 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?125,281881,281881#msg-281881</guid>
            <title>How to make an Entity relationships with Shopping casrt application (no replies)</title>
            <link>http://forums.mysql.com/read.php?125,281881,281881#msg-281881</link>
            <description><![CDATA[ Hi everyone. Can you please suggest me the idea of ER planning with any E commerce application. I am confused with this by thinking a lot of stuffs in my mind.<br />
 <br />
Thanks]]></description>
            <dc:creator>Vikas Tailor</dc:creator>
            <category>Database Design and Data Modelling</category>
            <pubDate>Fri, 18 Sep 2009 08:56:37 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?125,281551,281551#msg-281551</guid>
            <title>Query question (1 reply)</title>
            <link>http://forums.mysql.com/read.php?125,281551,281551#msg-281551</link>
            <description><![CDATA[ I'm not sure if this is the correct forum for this or not - if not, if someone could point me in the right direction, I'd be happy to repost the question there.<br />
<br />
We have a table of medical diagnosis records, and each diagnosis record contains a field called 'code' - a gov't assigned code for that particular diagnosis.<br />
<br />
A sampling of the codes might be something like:<br />
<br />
151<br />
151.1<br />
151.12<br />
151.2<br />
152<br />
153<br />
153.1<br />
154<br />
<br />
<br />
We want a query that would return the codes for which there are no more granular codes - so in the example above, 151 would not be returned; 151.1 would not be returned; 151.12 WOULD be returned, as would 151.2, and 152; 153 would NOT be returned, but 153.1 WOULD be returned, as would 154.<br />
<br />
does this make sense?<br />
<br />
Is there a query that would return this data that is not going to absolutely CRUSH performance?]]></description>
            <dc:creator>Neil Bailey</dc:creator>
            <category>Database Design and Data Modelling</category>
            <pubDate>Fri, 18 Sep 2009 03:09:11 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?125,280901,280901#msg-280901</guid>
            <title>storing multiple values as binary in one field (1 reply)</title>
            <link>http://forums.mysql.com/read.php?125,280901,280901#msg-280901</link>
            <description><![CDATA[ Hi<br />
I have a project where I need to store a large number of values.<br />
The data is a dataset holding 1024 2Byte Unsigned integer values. Now I store one value at one row together with a timestamp and a unik ID.<br />
This data is continously stored based on a time trigger.<br />
<br />
What I would like to do, is store all 1024 values in one field. So would it be possible to do some routine that stores all the 1024 2byte integer values in one field as binary. Some thing like when you store a image.<br />
<br />
Thanks.<br />
<br />
Br.<br />
Enghoej]]></description>
            <dc:creator>Ole Mortensen</dc:creator>
            <category>Database Design and Data Modelling</category>
            <pubDate>Sun, 13 Sep 2009 21:06:36 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?125,280573,280573#msg-280573</guid>
            <title>Database Design for Demography (no replies)</title>
            <link>http://forums.mysql.com/read.php?125,280573,280573#msg-280573</link>
            <description><![CDATA[ What would a good design be for a Demographic / Demographic Surveillance Database ??<br />
<br />
Does anyone have any links or tutorials on this ??]]></description>
            <dc:creator>Amit Tandon</dc:creator>
            <category>Database Design and Data Modelling</category>
            <pubDate>Thu, 10 Sep 2009 13:36:30 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?125,279208,279208#msg-279208</guid>
            <title>Simple Help With Multiple Tables and JOIN? (1 reply)</title>
            <link>http://forums.mysql.com/read.php?125,279208,279208#msg-279208</link>
            <description><![CDATA[ Hi All, <br />
<br />
I'm rather new to mysql, and could use some guidance in performing a query. I believe that I need to use the 'JOIN' operators.<br />
<br />
Here is what I have/what I'm trying to accomplish:<br />
<br />
table_players<br />
table_games<br />
joiningtable_players_games<br />
<br />
in table_players each player is given a unique 'player_id'<br />
<br />
in table_games each game is given a unique 'game_id' AND a field called 'playerTurn' to indicate whether it's player 1 or player 2's turn... simple <br />
enough<br />
<br />
in joiningtable_players_games i have 2 foreign keys (1 for 'player_id', 1 for 'game_id') and a field called 'assignedPlayerNumber' to indicate which playerNumber (1 or 2) this 'player_id' is in this unique game's record.<br />
<br />
I need to formulate a query statement in order to retrieve the NUMBER of games in which the GIVEN player_id   in which both the columns 'assignedPlayer' in 1 table, and 'playerTurnNumber' in the other are = . <br />
<br />
Does that make sense?<br />
<br />
I can't seem to retrieve the correct number of games in which this $player_id is assigned to the current playerTurnNumber in each respective game_id...<br />
<br />
I am using php, and attempting to use the command: mysql_num_rows($result)<br />
<br />
Can anyone help me out in formulating a correct Query SELECT statement?<br />
<br />
Thanks in advance...]]></description>
            <dc:creator>John Jackson</dc:creator>
            <category>Database Design and Data Modelling</category>
            <pubDate>Thu, 10 Sep 2009 14:08:04 +0000</pubDate>
        </item>
    </channel>
</rss>
