== Податочни побарувања == Оваа секција ги претставува концептуалниот дизајн на базата на податоци и податочните побарувања. === ЕР Дијаграм === [[Image(ER_Diagram_1.png, align=center, width=800)]] === **Ентитети** = 1. Client = Telephone number – varchar (Primary Key) Name – varchar (Mandatory attribute) Last name – varchar (Mandatory attribute) = 2. Motorcycle = Registration – varchar (Primary Key) Chassis number – varchar (Mandatory attribute) Year – date (Mandatory attribute) Model – varchar (Mandatory attribute) Client telephone number – varchar (Foreign Key to Client) = 3. Service = Service ID – serial (Primary Key) Client telephone number – varchar (Foreign Key to Client) Motorcycle registration – varchar (Foreign Key to Motorcycle) Service date – date (Mandatory attribute) Total price – numeric (Mandatory attribute) = 4. Mechanic = EMBG – numeric (Primary Key) Name – varchar (Mandatory attribute) Last name – varchar (Mandatory attribute) = 5. Service Mechanic (Junction Table for M:N Relationship between Service and Mechanic) = Service ID – serial (Foreign Key to Service) Mechanic EMBG – numeric (Foreign Key to Mechanic) = 6. ServiceInvoice = Invoice number – serial (Primary Key) Date – date (Mandatory attribute) Recipient – varchar (Foreign Key to Client) Photo copy – varchar (Mandatory attribute) = 7. FiscalBill = Fiscal ID – serial (Primary Key) DateTime – timestamp (Mandatory attribute) Issuer – varchar (Foreign Key to Client) Description – varchar Total price – numeric (Mandatory attribute) DDV – numeric (Mandatory attribute) EDB – varchar (Mandatory attribute) == Relationships == Client to Motorcycle: A Client can have multiple Motorcycles, but each Motorcycle belongs to one Client (1:N). * Foreign Key: client_telephone_number in Motorcycle references telephone_number in Client. Client to Service: A Service is associated with one Client, but a Client can have many Services (1:N). * Foreign Key: client_telephone_number in Service references telephone_number in Client. Motorcycle to Service: A Motorcycle can have many Services, but each Service is associated with one Motorcycle (1:N). * Foreign Key: motorcycle_registration in Service references registration in Motorcycle. Service to Mechanic: A Service can be performed by many Mechanics, and each Mechanic can work on many Services (M:N). * The service_mechanics table handles this many-to-many relationship, with service_id referencing Service and mechanic_embg referencing Mechanic. Client to ServiceInvoice: A Client can have many ServiceInvoices, but each ServiceInvoice belongs to one Client (1:N). * Foreign Key: recipient in ServiceInvoice references telephone_number in Client. Client to FiscalBill: A Client can have many FiscalBills, but each FiscalBill is issued by one Client (1:N). * Foreign Key: issuer in FiscalBill references telephone_number in Client.