Creating a Database

Discussion in 'MySQL' started by GroceryPriceBooks, Oct 15, 2007.

  1. #1
    Can anyone direct me to a GOOD tutorial on how to create a Database? I am completely new to all of this but willing to learn. I was trying to use this one http://www.tizag.com/mysqlTutorial/index.php but that wasn't working for me. I need something like The Morons Guide to making a database lol I don't need to make anything complicated just a simple 5 column page.

    Thanks!
     
    GroceryPriceBooks, Oct 15, 2007 IP
  2. iShopHQ

    iShopHQ Peon

    Messages:
    644
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    0
    #2
    what db you using? Are you asking about the theory of DB design, or how to actually do it?

    for newbies:
    every record needs a record id. one of your columns should be an auto-incrementing integer. this will be the record id.

    then create an excel spreadsheet with a one row that has all the values that will be in your database.
    example:

    tableBooks
    recordID|BookTitle|BookAuthor|DateOfPublication|Publisher

    Now look at each of those columns ans identofy those with values that could be duplicates. For example, a write might have written more than one book, so BookAuthor could contain a duplicate entry. Break that out into it's own table:

    tableAuthors
    recordID|AuthorFirstName|AuthorMiddleName|AuthorLastName

    Now instead of putting the author's name in the first able, you put the record id of the author from the author table

    Do the same thing for Publisher
    tablePublisher
    recordID|CompanyName|StreetAddress|City|State|Zip

    So a sample row with all cooresponding records would look like:
    tableBooks
    recordID|BookTitle|BookAuthor|DateOfPublication|PublishingHouse
    1|How to make a DB|1|2007|1

    tableAuthors
    recordID|AuthorFirstName|AuthorMiddleName|AuthorLastName
    1|iShop|nmn|HQ

    tablePublisher
    recordID|CompanyName|StreetAddress|City|State|Zip
    1|DigitalPoint Forum|123 Somewhere|SomePlace|CA|95693

    then you join the table when you do your query

    SELECT BookTitle, AuthorFirstName, AuthorLastName, DateOfPublication, CompanyName
    FROM tableBooks
    JOIN tableAuthors ON tableAuthors.recordID = tableBooks.BookAuthor
    JOIN tablePublishers ON tablePublishers.recrodID = tableBooks.Publisher
    ORDER BY BookTitle
     
    iShopHQ, Oct 15, 2007 IP
  3. Amilo

    Amilo Peon

    Messages:
    624
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Amilo, Oct 15, 2007 IP
  4. GroceryPriceBooks

    GroceryPriceBooks Peon

    Messages:
    501
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thank you for the help. Hopefully I can figure something out now! This is a tough thing to learn! lol
     
    GroceryPriceBooks, Oct 20, 2007 IP