Skip to content
Advertisement

problem with constraint order in create table in livesql

This gives error:

Create table alpha
  (keycol varchar(1)  primary key not null, pi float(10) not null ,
   evalue float(10)  not null default 2.7182 );

This doesn’t:

Create table alpha
  (keycol varchar(1)  primary key not null, pi float(10) not null ,
   evalue float(10)  default 2.7182 not null );

Why?

Advertisement

Answer

Each DBMS defined it’s syntax to write SQL. It only works if you obey their rules. It’s kind of obeying the law of a country while you are in it. You can’t ask why I should do that? You have to. Or choose any dbms you like.

If your dbms tells you to follow this syntax

Create table alpha
  (keycol varchar(1)  primary key not null, pi float(10) not null ,
   evalue float(10)  default 2.7182 not null );

then you just have to.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement