0

I am trying to create in postgresSQL 9.3 tables

CREATE TABLE Customer
(
  cid INT,
  name VARCHAR(32),
);
CREATE TABLE Product
(   
 producno INT,
 name VARCHAR,
 );
CREATE TABLE Order
 (
  oderid INT,
  shipdate DATE,
  cid INT,
 );
CREATE TABLE Ordered
(
 orderid INT,
 prodno INT,
 );

But I get an syntax error on line 5 ')'

SQL Status:42601 So I have already looked in PostgreSQL Error Codes so it says only that it is a syntax error But if I try it with other querys from the internet it works but trying to create my own I get an error

2 Answers 2

2

Remove comma from all the last fields

CREATE TABLE Customer
(
  cid INT,
  name VARCHAR(32),
);

to

CREATE TABLE Customer
(
  cid INT,
  name VARCHAR(32)
);

And so on for others.

Sign up to request clarification or add additional context in comments.

8 Comments

could you maybe help me with a relational algebra?
ok post that and you have tagged the question with mysql , postgreysql so make sure to specify which database you are trying to do the operation.
I have now SQL and want to create the RA here stackoverflow.com/questions/23781004/… and stackoverflow.com/questions/23791505/… and I am not sure if I've done it right
have you checked the answer from Michael Green that does exactly the thing you wanted. Now relational algebra is a representation of entity relations.And queries are basically in the form of SQL not relational expression.You may check cs.duke.edu/~junyang/ra this which converts a relational algebra to SQL
|
0

If column start with any number some time pg gives 42601 org.postgresql.util.PSQLException: ERROR: syntax error at or near "1" Position: 107

So pelase check table create sql before execution

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.