Skip to content
Advertisement

I am having issues with a syntax error in PostgreSQL. I am trying to add a query and it is giving me an error

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:

PostgreSQL

can someone help with this?

Advertisement

Answer

What you’re showing is a select statement

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
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement