Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9214263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:56:15+00:00 2026-06-18T01:56:15+00:00

I am completely new to databases and am having some confusion with Oracle syntax.

  • 0

I am completely new to databases and am having some confusion with Oracle syntax. I am trying to create a table with integrity constraints to accompany it.

Here is my code:

   CREATE TABLE  Students 
( 
id                INTEGER, 
name              CHAR(10)    NOT NULL,  
classification    CHAR(10)    NOT NULL, 
hours             INTEGER, 
gpa               NUMBER(3,2) NOT NULL, 
mentor            INTEGER, 

CONSTRAINT IC1 CHECK (PRIMARY KEY (id))
CONSTRAINT IC2 CHECK (classification = 'freshman' or classification = 'sophomore' or classification = 'junior' or classification = 'senior')
CONSTRAINT IC3 CHECK (gpa >= 0 AND gpa <= 4) 
CONSTRAINT IC4 CHECK (classification = 'junior' AND hours >= 55 AND hours <= 84)  ); 

However whenever I run the code I get:

SQL> CONSTRAINT IC1 CHECK (PRIMARY KEY (id))
SP2-0734: unknown command beginning "CONSTRAINT..." - rest of line ignored.
SQL> CONSTRAINT IC2 CHECK (classification = 'freshman' or classification = 'sophomore' or classification = 'junior' or classification = 'senior')
SP2-0734: unknown command beginning "CONSTRAINT..." - rest of line ignored.
SQL> CONSTRAINT IC3 CHECK (gpa >= 0 AND gpa <= 4)
SP2-0734: unknown command beginning "CONSTRAINT..." - rest of line ignored.
SQL> CONSTRAINT IC4 CHECK (classification = 'junior' AND hours >= 55 AND hours <= 84)  );
SP2-0734: unknown command beginning "CONSTRAINT..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT. 

Can someone help me with my constraint syntax?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T01:56:16+00:00Added an answer on June 18, 2026 at 1:56 am

    There is a syntax error in the declaration of the primary key constraint. A primary key constraint is not a check constraint so you don’t want the CHECK keyword. You also need commas after each inline constraint definition

    SQL> ed
    Wrote file afiedt.buf
    
      1     CREATE TABLE  Students
      2  (
      3  id                INTEGER,
      4  name              CHAR(10)    NOT NULL,
      5  classification    CHAR(10)    NOT NULL,
      6  hours             INTEGER,
      7  gpa               NUMBER(3,2) NOT NULL,
      8  mentor            INTEGER,
      9  CONSTRAINT IC1 PRIMARY KEY (id),
     10  CONSTRAINT IC2 CHECK (classification = 'freshman' or classification = 'sophomore' or classification = 'junior' or classification = 'senior'),
     11  CONSTRAINT IC3 CHECK (gpa >= 0 AND gpa <= 4) ,
     12* CONSTRAINT IC4 CHECK (classification = 'junior' AND hours >= 55 AND hours <= 84)  )
    SQL> /
    
    Table created.
    

    Depending on the front-end tool you are using and the settings that tool has, you may want to avoid having completely blank lines in the middle of your SQL statements. It’s perfectly valid syntax from a SQL perspective. But some front ends will interpret the blank line as ending the prior statement.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm completely new to javascript, but I'm trying to create a beta form for
I am having some problems while trying to create integration tests with Selenium and
Being completely new to Java EE (but not to Java itself) I'm trying to
I'm completely new to Oracle's XDB, in particular using it to generate XML output
Completely new to most of this stuff, but basically Im playing around with the
Completely new to asp.net mvc... completely new to web apps so bear with me...
Completely new to java and I have been playing around with regex in a
I am completely new to HTML5 and have been reading about it for the
I am completely new to Jena/TDB. All I want to do is to load
I am Completely new to Objective C and Cocoa programming. Why does NSApplicationMain not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.