Forum Moderators: phranque

Message Too Old, No Replies

Designing a database for a new website

need advice please

         

Andrew Thomas

11:21 am on Feb 3, 2003 (gmt 0)

10+ Year Member



Im building a website which will have various searches.

its based on renting houses, and the users will be able to search on Location, Area, House name, Amount of rooms, price range, garage.... etc...

I can create the SQL for these OK, but im designing an access database and am not sure whether i should use just one table with all the info, or a number of tables, eg a table for Loactaion and area, etc.

Could someone please advice the best way and why?

thankyou

bcc1234

12:29 pm on Feb 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's better to normalize your data to some degree in 99% of cases.

added:
Oh, why?

Save space and avoid anomalies.

SuzyUK

12:56 pm on Feb 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



you can do the queries in Access the use these queries as your tables (like stored procedures)....
(I think that's what is meant by normalising..)

If you set up one main table with everything in, then set up lots of queries from this which are relevant to your particular search criteria..the connect the page to the query instead of the main table

Suzy

rogerd

1:23 pm on Feb 3, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Hmmm, I may be missing the boat with this reply, but the purpose of using multiple tables is to avoid redundant information and allow easy updating. For instance, you could store all information related to particular communities in a table, and then just link to that data from your database of property listings. Similarly, you could have a table of "salespeople" that would contain the phone numbers, addresses, etc., for each salesperson. The data isn't replicated in the listings, and if it changes it only has to be maintained in one place. Access makes setting up relational databases very easy. Hope this helps, sorry if I missed the point.

Andrew Thomas

1:27 pm on Feb 3, 2003 (gmt 0)

10+ Year Member



Ive looked into my table, there are not many more fields than i already mentioned above.

I cant really see how i can normalise this, or am i missing something?

bcc1234

1:30 pm on Feb 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you set up one main table with everything in, then set up lots of queries from this which are relevant to your particular search criteria..the connect the page to the query instead of the main table

Actually, it's quite opposite.

You normalize data by splitting it into different tables with different relations and then use views (you can use queries in access as views) to join data in any way you need.

mole

1:31 pm on Feb 3, 2003 (gmt 0)

10+ Year Member



Aside from the technical issues to do with normalising tables, size of tables, complexity of joins and so on, I have one point which I would make.......

With the sort of data you're going to be handling, I'd suggest you use lookup tables for a variety of items e.g. "Location".

Why?

'cos if you do it that way you always have very clean data and you don't end up with a DB full of stuff that doesn't quite match what it should be.

Example:
(1) data comes from lookup table which contains the entry "North and Central Somewhere"
-> all entries are exactly that.

(2) data gets typed in willy-nilly
-> you get entries like
"North and Central Somewhere"
"North & Central Somewhere"
"NC Somewhere"

makes your life a lot easier if you're trying to search (1)

Andrew Thomas

1:40 pm on Feb 3, 2003 (gmt 0)

10+ Year Member



Thanks - im beginning to understand now.

Maybe i could have a table with location, table with area and then all the houses in a seperate table

Andy

SuzyUK

1:51 pm on Feb 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




If you set up one main table with everything in, then set up lots of queries from this which are relevant to your particular search criteria..the connect the page to the query instead of the main table

Actually, it's quite opposite.

You normalize data by splitting it into different tables with different relations and then use views (you can use queries in access as views) to join data in any way you need.

Yes you're quite right...I just didn't explain very well at all :(

That's what I meant (honest guv!, it's what I do anyway:)) by setting up a main table..but of course it should've been main tables with relationships.

hadn't meant to confuse the issue it's just that some people don't know that you can use queries (views) in this way and that had been the point I was tring to make

Sorry
Suzy

<added> Andrew yes, then in your houses table have "lookup" columns to link to the other tables</added>

aspdaddy

2:56 pm on Feb 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I would definetley normalise it.

I did an online estate agents and within days they wanted to add more uk regions, then more house types.

Do it properly and they can administer it all themselfs without worry of breaking it.

Its just one single table for properties and one table for each dimension.

Brett_Tabke

6:34 am on Feb 4, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



How big are you talking? Small, medium, huge, or extreme? (500k, 5meg, 20meg, or 200meg+)?

If it is a small setup, I'd do whatever is easiest to program and then let the program do any post processing. If it is large or a huge db where speed is going to be a consideration, then spreading out for easy xrefing is the way to go.

Andrew Thomas

9:13 am on Feb 4, 2003 (gmt 0)

10+ Year Member



Well at first it will be very small, hopefully with promotion etc.. it will get huge in time, but im not expecting overnight sucess :)(dont know what huge is, but i estimate about 1000 records in the first year)and hopefully lots of visitors

Im doing it in Access first, and then when i get to grips with SQL database, and if it needs it, i will migrate over.

As far as the design is concerned, i want to do it the right way first time, so i sounds as if normalisation is the way to go.

thanks for all the posts

bcc1234

5:11 pm on Feb 4, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



1000 records won't be a problem any way you structure it.
Even if your db has to sequentially scan 1000 tuples for each request - don't worry about it.

RZaakir

5:57 pm on Feb 4, 2003 (gmt 0)

10+ Year Member



I couldn't stress how much normalization would keep your sanity. It also helps in ways not mentioned. When you break out your redundant info into other tables, you can use those tables to build menu boxes so that data entry is easier and you don't have to maintain your forms as much.

Example:

You're building a search form and in your database there are 5 regions that correspond to your data. When you build your search form, you could hand code a drop down menu box to have these 5 regions displayed and it would work fine. However, if you ever added, deleted, or changed the name of this region, you would have to edit html that generates the menu box.

If your data is normalized and the regions are in a seperate table, you can dynamically create a menu box with the values from that table. So if there were ever an edit made to that data, it would instantly be reflected in your search form. Yeah there is more overhead here, but it is worth checking out.

I would also caution against MS Access. I have had lots of data corruption problems when multiple connections are made to the database. It may possibly be worth your while to delay production (if its an option and I know that it probably isn't) and learn SQL Server so that you don't grow into this problem. It's not nearly as difficult as some make it out to be, assuming that somebody else (a webhost?) would be doing the set up and maintenance.

rogerd

6:51 pm on Feb 4, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



For 1000 records and modest traffic, I think Access will be fine. I've got multiple decent volume ASP e-commerce sites using Access and I haven't yet seen a problem that would justify upgrading to SQL Server.

ukgimp

9:37 am on Feb 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>>learn SQL Server

With that goes the possibilty of being plundered and pillaged by M$. Think about using mySQL. Lots of support and it works very well. A bit of a learning curve now and you wont have to bother with a complex changeover later on.

Cheers

Andrew Thomas

9:43 am on Feb 5, 2003 (gmt 0)

10+ Year Member



Thanks for the comments - My current reseller doesnt allow mysql :( - as for SQL i will migrate to at a later date if it takes off as i hope, as my reseller charges per MB for this database - Access is the cheaper option for now.

ukgimp

10:03 am on Feb 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Why not change reseller. You are uk based and there has to be loads out there that offer mySQL and not a great charge as it is essentially free.

Andrew Thomas

10:15 am on Feb 5, 2003 (gmt 0)

10+ Year Member



>>Change reseller.

I have a few domains with this reseller, and they are good for the money. Im worried if i change i will be worse off, etc etc.. I basically want to build everything up, and then see if it is worth while changing databases, hosts etc... I just want to get the project off the ground

jamesa

10:27 am on Feb 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Also think about the type of queries you'll be making. Since your db will probably be busiest with select statements, you'll get much better performance if the fields you're searching on (in the where clause) is all in one table. Searching fields across multiple tables is very expensive.

Andrew Thomas

11:08 am on Feb 5, 2003 (gmt 0)

10+ Year Member



Queries - Ive created my tables and normalised then (3 tables) and ive created a query in Access. Should i just copy this query into my asp, or call it from Access.

If the answer is call it from Access, how do i do this?

thanks

ukgimp

11:38 am on Feb 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Andrew

Let Access do the work as opposed to ASP.

Have you got a copy of Dreamweaver UltraDev or MX. That lets you do the sorts of things you are after very easily (little messy with the code though)

Andrew Thomas

11:42 am on Feb 5, 2003 (gmt 0)

10+ Year Member



Yes, ive got MX, but im not sure how to link to the query, is it the same as setting up a recordset?

Woz

11:56 am on Feb 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>Let Access do the work as opposed to ASP.

Absolutely! Always let the database program, whatever it is, do the work of querying and manipulating the data, and use ASP simply to retrieve and send data. That will speed thigs up quite a bit, but it does mean designing the database with more care.

Onya
Woz

SuzyUK

3:01 pm on Feb 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Andrew


Yes, ive got MX, but im not sure how to link to the query, is it the same as setting up a recordset?

Yes exactly the same
"SELECT * FROM queryTable"

(PS I always give my query tables a name that starts "que" e.g queTableName..just so I know where I'm calling from)

Suzy

[edit]sp![/edit]

RZaakir

3:46 pm on Feb 5, 2003 (gmt 0)

10+ Year Member



>>With that goes the possibilty of being plundered and pillaged by M$.

My SQL Server suggestion is based off of the fact that SQL server offers features like Views and Stored Procedures that integrate easily with ASP. Using MySQL (which apparently isn't even supported) with ASP requires a MySQL driver that most web hosts that I've seen do not install.

My only problem with MySQL is that it doesn't have either of the above, nor does it have triggers. While these are not entry level features, the sooner that a developer learns how to use them the more effective (and portable) the code becomes. Access and mySQL can't offer this level of power, though MySQL is certainly very fast, which has to count for something.

As for the plundering, you should know that a competent administrator can prevent this.

ukgimp

4:03 pm on Feb 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As for the plundering, you should know that a competent administrator can prevent this.

That is true :) but M$ do tie people in for longer and their stuff is not as interoperable with other systems due to their coding etc.

Recently I got hammered by M$ during an upgrade. What I found out was that on Win 95, Exchange was free, now it is not and I was required to find around £800 so that three PC’s could share each others diaries and contacts. To buy a copy of Office for each machine also costs a small fortune (£3-400) because they don’t do an upgrade for 95. Now if I was a student I could buy XP Office Pro for £100 but I cant. No wonder there is piracy and a general dislike to M$.

When all is said and done I like M$Office I just don’t like the prices.

Off topic I know...

bcc1234

9:03 am on Feb 6, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



My only problem with MySQL is that it doesn't have either of the above...

I could enver understand why people use MySQL when PostgreSQL exists :)