The table shows sample data for the table REPAIR_PART.
| PartID | RepairNumber | Quantity |
|---|---|---|
| ACD128SA | 0022 | 3 |
| PPOR543DWW | 0022 | 1 |
| TR453 | 0023 | 1 |
| PPOR543DWW | 0023 | 2 |
| WED5 | 0024 | 5 |
Write a Structured Query Language (SQL) script to define the table REPAIR_PART.
Include constraints (restrictions) on the data that can be entered into each field where appropriate.
(5 marks)
(iii) Suppliers send invoices to the company for the parts that are used. A new table, INVOICE, stores the data about each invoice and whether it has been paid or not.
The design for the table INVOICE is shown:
INVOICE(InvoiceID, SupplierID, AmountDue, Paid, DatePaid)
The table shows sample data for the table INVOICE.
| InvoiceID | SupplierID | AmountDue | Paid | DatePaid |
|---|---|---|---|---|
| 000001 | JK675 | 22.50 | TRUE | 01/01/2024 |
| 000002 | WR443 | 358.99 | FALSE | |
| 000003 | JK675 | 10.21 | FALSE |
Write an SQL script to return the total amount due to the supplier with the ID of JK675 for all the invoices that have not currently been paid.