Re: Hi! We're a bit stuck while making a database. Could use a bit of advice
Posted by: Peter Brawley
Date: May 17, 2019 06:28AM

Database design ain't like riding a bicycle, you can't just get on and go, there's semester or more of knowledge you need. Read some primers, eg ...

https://www.artfulsoftware.com/mysqlbook/sampler/mysqled1ch01.html

http://www.artfulsoftware.com/dbdesignbasics.html

and follow up on issues that aren't clear to you.

Minimally you probably need something like ...

clients ( 
  cid unsigned smallint primary key auto_increment, /* read about surrogate keys */
  company_name, 
  ... 
)

operations ( opid unsigned smallint primary key auto_increment, name, basefee decimal(10,2), ... )

clientops ( 
  copid unsigned int primary key auto_increment,
  dt date, 
  hrs time,
  see decimal(8,2),
  cid smallint unsigned,
  opid smallint unsigned,
  foreign key(cid) references clients(cid) on delete cascade on update cascade,
  foreign key(opid) references operations(opid) on delete cascade on update cascade,
)

invoices (
  invid unsigned int primary key auto_increment,
  dt date,
  cid unsigned smallint,
  foreign key(cid) references clients(cid) on delete cascade on update cascade,
   ...
invlineitems ( ...)

payments(  ... etc ... )

Options: ReplyQuote


Subject
Written By
Posted
Re: Hi! We're a bit stuck while making a database. Could use a bit of advice
May 17, 2019 06:28AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.