Hi Folks,
i've bitten the bullet and started learning MySQL. As part of this I am setting up a DB to store references for my studies. You know the thing, you have a paper to write and need to have a stock of references to 'use'. I've used forums, web articles and 'PHP and MySQL web development' by Luke welling for my learning.
I set up a DB called 'refs' with 2 tables (so far)'books' and 'publisher'.
The SQL i used is
>>start SQL<<
create table books
( isbn char(13) not null primary key,
author char (60) not null,
title char (120) not null,
pubdate char (15),
edition char (4),
pub char (60)
);
create table publisher
( id int unsigned not null auto_increment primary key,
publisher char (60) not null,
address char (120) not null,
city char (20) not null
);
<<<end SQL>>>
Could anyone help me get my schema in order? As many books share the same publisher (especially in my profession(medical)) I would like an easy way to enter the publisher into the books table.
As an example, I would like to enter say 'SAMS' in books.pub and have this look up SAMS in the publisher table so that I can join them later to give a full academic (Harvard) reference with the Address etc included, formatted with PHP.
Eventually I will turn this into a webapp driven by PHP, so when entering a book into the DB the user will either be able to type just the publisher name or select from a list if the publisher is already in the DB - if it is not then the user will have to enter the full publisher details. I am sure there is an easier way to explain this and I trust you guru's will understand me
Any help greatly appreciated,
best wishes
Mike
i've bitten the bullet and started learning MySQL. As part of this I am setting up a DB to store references for my studies. You know the thing, you have a paper to write and need to have a stock of references to 'use'. I've used forums, web articles and 'PHP and MySQL web development' by Luke welling for my learning.
I set up a DB called 'refs' with 2 tables (so far)'books' and 'publisher'.
The SQL i used is
>>start SQL<<
create table books
( isbn char(13) not null primary key,
author char (60) not null,
title char (120) not null,
pubdate char (15),
edition char (4),
pub char (60)
);
create table publisher
( id int unsigned not null auto_increment primary key,
publisher char (60) not null,
address char (120) not null,
city char (20) not null
);
<<<end SQL>>>
Could anyone help me get my schema in order? As many books share the same publisher (especially in my profession(medical)) I would like an easy way to enter the publisher into the books table.
As an example, I would like to enter say 'SAMS' in books.pub and have this look up SAMS in the publisher table so that I can join them later to give a full academic (Harvard) reference with the Address etc included, formatted with PHP.
Eventually I will turn this into a webapp driven by PHP, so when entering a book into the DB the user will either be able to type just the publisher name or select from a list if the publisher is already in the DB - if it is not then the user will have to enter the full publisher details. I am sure there is an easier way to explain this and I trust you guru's will understand me
Any help greatly appreciated,
best wishes
Mike