Veronika Milovzorova portfolio/ est

aviafirma

town_to char(25),
time_out datetime,
time_in datetime
);
create table Passenger (
ID_psg int primary key auto_increment,
name char(20)
);
create table Pass_in_trip (
trip_no  int primary key auto_increment,
foreign key (trip_no) references Trip(trip_no),
date_ datetime,
ID_psg int,
foreign key (ID_psg) references Passenger(ID_psg),
place char(10)
)
create table pass_in_trip (
    trip_no int,
    FOREIGN KEY (trip_no) REFERENCES Trip(trip_no),
    date_datetime,
    ID_psg int,
    FOREIGN KEY(ID_psg) REFERENCES Passenger(ID_psg),
    place char(10)
    PRIMARY KEY (trip_no, date_, ID_psg)
    )
    
    
INSERT INTO passenger(name)
VALUES('Kany');
INSERT INTO passenger(name)
VALUES('Mark');
INSERT INTO passenger(name)
VALUES('Rafaelo');
INSERT INTO passenger(name)
VALUES('Stella');
INSERT INTO passenger(name)
VALUES('Ekaterina');
INSERT INTO company(name)
VALUES('Estonia Air');
INSERT INTO company(name)
VALUES('Air Baltic');
INSERT INTO company(name)
VALUES('Turkish');
INSERT INTO company(name)
VALUES('USA Airlines');
INSERT INTO company(name)
VALUES('Russia air');
alter table company
add rating char(3);
update company set rating = 5 where ID_comp = 1;
update company set rating = 4.5 where ID_comp = 2;
update company set rating = 5 where ID_comp = 3;
update company set rating = 5 where ID_comp = 4;
update company set rating = 4.5 where ID_comp = 5;
select count(ID_comp) as number_of_values from company
SELECT plane, COUNT(plane) AS Kogus
FROM Trip
GROUP by plane

et