Q:

Create Table using SQL with primary key starting with 'A'

I'm trying to create a table using SQL. I want my primary key - ArCode to start with the letter 'A'. I have used combinations of check and like but to no avail.
Here is my Query:
Create table Article(
ArCode Char(5) Check (ArCode LIKE 'A%') Primary Key,
ArName Varchar2(30) Not Null,
Rate Number(8,2),
Quantity Number(4) Check (Quantity >=0) Default 0,
Class Char(1) Check (Class In ('A','B','C'))
);

When I execute the query I get a missing right parenthesis error. I'm not able to figure it out.

A:

Your error is with the definition of the Quantity column.  Commenting that out, or just fixing it such that default comes before the check constraint allows the create table statement to run just fine:
Create table Article(
  ArCode Char(5) Check (ArCode LIKE 'A%') Primary Key,
  ArName Varchar2(30) Not Null,
  Rate Number(8,2),
--  Quantity Number(4) Check (Quantity >=0) Default 0,
  Quantity Number(4)  Default 0 Check (Quantity >=0),
  Class Char(1) Check (Class In ('A','B','C'))
);

