sample database -
CREATE TABLE Person (
driver_id INT PRIMARY KEY,
name VARCHAR(50) NOT NULL,
address VARCHAR(100)
);
CREATE TABLE Car (
license VARCHAR(20) PRIMARY KEY,
model VARCHAR(50) NOT NULL,
year INT
);
CREATE TABLE Accident (
reportno INT PRIMARY KEY,
date DATE NOT NULL,
location VARCHAR(100)
);
CREATE TABLE Owns (
driver_id INT,
license VARCHAR(20),
PRIMARY KEY(driver_id, license),
FOREIGN KEY(driver_id) REFERENCES Person(driver_id),
FOREIGN KEY(license) REFERENCES Car(license)
);
INSERT INTO Person VALUES (1, 'John Doe', '123 Main St, Anytown, USA');
INSERT INTO Person VALUES (2, 'Jane Smith', '456 Oak St, Othertown, USA');
INSERT INTO Person VALUES (3, 'Bob Johnson', '789 Elm St, Somewhere, USA');
INSERT INTO Car VALUES ('ABC123', 'Toyota Camry', 2005);
INSERT INTO Car VALUES ('DEF456', 'Ford Mustang', 2010);
INSERT INTO Car VALUES ('GHI789', 'Chevy Malibu', 2007);
INSERT INTO Accident VALUES (1001, '2004-01-01', 'Main St and Elm St');
INSERT INTO Accident VALUES (1002, '2004-02-02', 'Oak St and Maple St');
INSERT INTO Accident VALUES (1003, '2005-03-03', 'Elm St and Pine St');
INSERT INTO Owns VALUES (1, 'ABC123');
INSERT INTO Owns VALUES (1, 'DEF456');
INSERT INTO Owns VALUES (2, 'GHI789');