CREATE TABLE Owners (
    id INT PRIMARY KEY AUTO_INCREMENT,
    last_name VARCHAR(100) NOT NULL,
    address VARCHAR(255) NOT NULL
);

CREATE TABLE Cars (
    id INT PRIMARY KEY AUTO_INCREMENT,
    car_number VARCHAR(20) NOT NULL UNIQUE,
    year_of_issue INT NOT NULL,
    brand VARCHAR(100) NOT NULL,
    color VARCHAR(50) NOT NULL,
    car_condition VARCHAR(100) NOT NULL,
    owner_id INT NOT NULL,
    FOREIGN KEY (owner_id) REFERENCES Owners(id)
);

INSERT INTO Owners (last_name, address) VALUES
('Ivanov', 'Lenina St. 10'),
('Petrov', 'Gagarina St. 25'),
('Sidorov', 'Mira Ave. 7'),
('Kuznetsov', 'Abaya St. 14');

INSERT INTO Cars (car_number, year_of_issue, brand, color, car_condition, owner_id) VALUES
('A123BC', 2015, 'Toyota', 'White', 'Good', 1),
('B456DE', 2018, 'BMW', 'Black', 'Excellent', 2),
('C789FG', 2010, 'Lada', 'Blue', 'Fair', 3),
('D321HI', 2020, 'Kia', 'Red', 'New', 4),
('E654JK', 2017, 'Hyundai', 'Gray', 'Good', 1);

SELECT 
    Cars.id,
    car_number,
    year_of_issue,
    brand,
    color,
    car_condition,
    Owners.last_name,
    Owners.address
FROM Cars
INNER JOIN Owners ON Cars.owner_id = Owners.id
ORDER BY Cars.id;