I am taking a Data Analysis Course on Udemy. I am using PostgreSQL. On one of my exercises, I tried to add a column of data and recieved a Syntax Error Message. Here is a screen shot of my code:
can someone help with this?
Advertisement
Answer
What you’re showing is a select statement
x
SELECT DISTINCT CustomerName, Region, Industry
FROM sales
WHERE Region = 'West'
To add another criterion, use and
as follows
SELECT DISTINCT CustomerName, Region, Industry
FROM sales
WHERE Region = 'West'
AND Industry = 'BusinessServices'
If you want to add a column to the table itself, proceed as follows
alter table sales add column Industry varchar