Kamalpreet Kaur
Kamalpreet Kaur
IDENTIFYING 986037
2. Data Model
3. Normalization to 3NF
The current model is already in 3NF because:
All non-key attributes are fully dependent on the primary key of the table they belong to.
There are no transitive dependencies.
4. Data Dictionary
Table: Customer
Table: Device
Table: Repair
Table: Employee
Code:
use Kamalpreet;
);
);
-- Creating the Repair Table
);
);
File Name:
-- For the Addition of 10 devices (replace model names with your choices)
-- For the addition of customer details (replace details with your information)
VALUES
UPDATE Device
WHERE d_DeviceID = 5;
-- For the updation of phone number
UPDATE Customer
WHERE c_CustomerID = 3;
-- For the addition of instructor details
('Sakhshi Kapoor', 'Wentworth Institute of Higher Education, Sydney, Australia', '(02) 8252-999');
-- For showing the repairs for the 2nd customer (Kamalpreet Kaur)
FROM Repair r
-- For listing the customer names for repairs involving "Battery Replacement"
SELECT c.c_Name
FROM Customer c
FROM Customer c
GROUP BY c.c_Name;
-- For listing all devices repaired for you (assuming you're customer 1)
FROM Device d
WHERE r.r_CustomerID = 1;
SELECT e.e_Name
FROM Employee e
WHERE EXISTS (
SELECT 1
FROM Repair r
SELECT c.c_Name
FROM Customer c
SELECT d.d_Type
FROM (
FROM Device d
GROUP BY d.d_Type
LIMIT 1
) AS MostCommonDevice
FROM Customer c
JOIN Repair r ON c.c_CustomerID = r.r_CustomerID
GROUP BY CustomerName;