11.07.2015 Views

Release Team[oR] 2001 [x] Database - Kataix Umag Cl

Release Team[oR] 2001 [x] Database - Kataix Umag Cl

Release Team[oR] 2001 [x] Database - Kataix Umag Cl

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

one, one-to-many, and many-to-many. You learned what each one does and how to implement thisrelationship inside the database. Also, today I introduced the Meet-A-Geek project. This project is based onan actual site running MySQL. You practiced the techniques and concepts you learned today on this sampleproject.The concepts that were covered today can be applied to any database. They are in this book because,from my experience, there is nothing more important to a database than its design. If you are going tobe a MySQL administrator or a programmer writing a program to access the data contained in a MySQLdatabase, it is essential that you know how to design a database.Q&AQ: This design process seems like a waste of time. Why should I spendall this time designing when I could spend it actually creating thedatabase?A: The time spent carefully designing a database will be recouped tenfoldwhen it come to the creating and maintaining of the database. If thedatabase is not well-thought-out or designed correctly, you will spendcountless hours adding fields and relationships you may have missed.Extracting the information will also take longer because databases that arehastily put together tend not to be normalized. This results in redundantdata, as well as wasted disk space. So the extra hours you spend designingwill pay off later.Q: What purpose does modeling the database serve?A: Modeling the database serves several functions. First, it provides a visualrepresentation of the logic and flow of your design. This will allow you topinpoint exactly where the flaws or weaknesses exist in your design.Second, it provides a good source of documentation for your database. Themodel contains all of the tables, their relationships, the fields, and fieldtypes. There is no better source of documentation than a good model.Exercises1. In the Meet-A-Geek project, you defined several business objects. Can you defineany more objects?2. Come up with the rest of the business rules for the Meet-A-Geek project.Day 4: Creating Your First <strong>Database</strong>OverviewCreating a database is probably one of the most important, yet least used, of all the MySQL functions. Thereare many ways to accomplish this task in MySQL. Today, you will learn the following:• The CREATE and DROP commands• Using the mysqladmin utility• Adding users to your database• Creating the Meet-A-Geek databaseThe CREATE and DROP CommandsWhen you think of the CREATE and DROP commands, you should envision earthmoving equipment, dumptrucks, and cranes, because these are the tools you use to create your database. These commands, thoughseldom used, are the most important. Hopefully, a lot of thought has gone into the decision making processbefore either of these commands is issued.The CREATE CommandThere are many different ways to create databases in MySQL. When you create a database, you usually willhave the entire layout ready. Normally, you would add the tables immediately after creating the database,but, because this book is a training guide, you will take it one step at a time.The first way to create a database in MySQL is to enter the SQL (Structured Query Language)command CREATE DATABASE>databasename in the MySQL monitor, where databasename is thename of the database you are creating. Perform the following steps to create this sample database:- 32 -

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!