Mysql – How to create a view joining the following tables? I want to find cities that have the same name as students’ first names

MySQL

SELECT * FROM `assignment-one-db`.student;

INSERT INTO city (id, firstname, lastname, email)
VALUES (1, 'Maria', 'Popescu', 'maria.popescu@yahoo.com');

SELECT * FROM `assignment-one-db`.city;

INSERT INTO city (city_id, name, latitude, longitude)
VALUES (1, 'Sibiu', 13, 14);

Best Answer

CREATE VIEW V AS
SELECT cty.name
  FROM `assignment-one-db`.student st, 
       `assignment-one-db`.city cty
  WHERE st.firstname = cty.name;