Thanks for the reply!  Should I change the structure such that all
varchar fields are in the same table?

I believe you did understand my design correctly.  Available_properties
contains the primary data.  Property names is just a table that contains
subsequent data for available_properties and details will be a link from
the properties.php page to properties/details.php  I added the other two
keys as columns to available_properties.  Let me know if I should
restructure anything.  

thanks, jusitn


mysql> show tables;
+----------------------+
| Tables_in_properties |
+----------------------+
| available_properties |
| details              |
| property_names       |
+----------------------+
3 rows in set (0.00 sec)

mysql> desc available_properties;
+-----------------+--------------+------+-----+---------+---------------
-+
| Field           | Type         | Null | Key | Default | Extra
|
+-----------------+--------------+------+-----+---------+---------------
-+
| av_pro_id       | int(11)      |      | PRI | NULL    | auto_increment
|
| property_name   | varchar(50)  |      |     |         |
|
| type            | varchar(50)  | YES  |     | NULL    |
|
| city            | varchar(25)  | YES  |     | NULL    |
|
| description     | varchar(125) | YES  |     | NULL    |
|
| number_of_units | varchar(25)  | YES  |     | NULL    |
|
| pro_id          | int(11)      |      |     | 0       |
|
| d_id            | int(11)      |      |     | 0       |
|
+-----------------+--------------+------+-----+---------+---------------
-+
8 rows in set (0.00 sec)

mysql> desc property_names;
+---------------+--------------+------+-----+---------+----------------+
| Field         | Type         | Null | Key | Default | Extra          |
+---------------+--------------+------+-----+---------+----------------+
| pro_id        | int(11)      |      | PRI | NULL    | auto_increment |
| property_name | varchar(50)  |      |     |         |                |
| address       | varchar(100) | YES  |     | NULL    |                |
| cross_street  | varchar(50)  | YES  |     | NULL    |                |
+---------------+--------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)

mysql> desc details;
+-------------+-------------+------+-----+---------+----------------+
| Field       | Type        | Null | Key | Default | Extra          |
+-------------+-------------+------+-----+---------+----------------+
| d_id        | int(11)     |      | PRI | NULL    | auto_increment |
| type        | varchar(50) | YES  |     | NULL    |                |
| price       | smallint(6) | YES  |     | NULL    |                |
| floor       | varchar(15) | YES  |     | NULL    |                |
| sq_ft       | smallint(6) | YES  |     | NULL    |                |
| suite       | smallint(6) | YES  |     | NULL    |                |
| description | text        | YES  |     | NULL    |                |
| available   | varchar(15) | YES  |     | NULL    |                |
+-------------+-------------+------+-----+---------+----------------+
8 rows in set (0.00 sec)

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Benjamin
Pflugmann
Sent: Tuesday, May 28, 2002 3:24 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: first mysql table; syntax qustion

Hi.

Looks okay, except that you probably want to reference via pro_id and
d_id in table available_properties (given that I understood your table
layout correctly). It is usally considered bad design to repeat the
values itself (the varchars) in several tables.

Bye,

        Benjamin.


On Tue, May 28, 2002 at 12:17:55PM -0700, [EMAIL PROTECTED] wrote:
> Hello list, this is my first table for a simple php page and I'm
hoping
> someone could briefly review its structure.  The only fields I'll be
> sharing are property_name and type.  Are they set up properly for
select
> join queries?
> 
> thank you, justin
> 
> Database=properties
> 
> Tables are available_properties, property_names, and details
> 
> create table available_properties (
> av_pro_id int not null auto_increment 
> property_name varchar (50) not null
> type varchar (25)
> city varchar (25) 
> description varchar (125)
> number_of_units varchar (25)
> primary key (av_pro_id)
> );
> 
> create table property_names (
> pro_id int not null auto_increment
> property_name varchar (50) not null 
> address varchar (100)
> cross_street varchar (50)
> primary key (pro_id)
> );
> 
> create table details (
> d_id int not null auto_increment
> type varchar (25)
> price smallint
> floor varchar (15)
> sq_ft smallint
> suite smallint
> description text
> available varchar (15)
> primary key (d_id)
> );
> 

-- 
[EMAIL PROTECTED]

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to