How to solve ERROR 1060: Duplicate column name using Views -> Create View
<p>I am trying to create a view from joining some tables (in MySQL) from Sakila database (<a href="https://dev.mysql.com/doc/sakila/en/" rel="nofollow noreferrer">https://dev.mysql.com/doc/sakila/en/</a>), namely I want to join payment, staff and customer and display the customer's name, the staff's name, the payment id and amount. 
I right clicked on Views and then Create Table. 
I think this error exists because of the fact that in the staff table and in the customer table there are both columns named first_name and last_name. How could I solve this problem? </p>

<p>My code: </p>

<pre><code>CREATE VIEW `payment` AS
SELECT payment.payment_id, customer.first_name, customer.last_name, 
staff.first_name, staff.last_name, payment.amount
FROM payment INNER JOIN customer ON payment.customer_ID = customer.customer_ID
INNER JOIN staff ON payment.staff_ID = staff.staff_ID
</code></pre>

<p>The error message:
ERROR 1060: Duplicate column name 'first_name'</p>

<p>If I try it with aliases, as some of the answerers suggested, I get the error ERROR 1347: 'sakila.payment' is not VIEW.</p>

<p>The exact same code works like a charm in SQL File, when I run it, it creates the table I need. What is the difference between these two methods? Which one should I use? And why didn't it work with the Views -> Create View option?</p>

<p>Thank you in advance.</p>