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 669867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:11:53+00:00 2026-05-14T00:11:53+00:00

What is the difference between these to ways of table creation. CREATE TABLE TABLENAME(

  • 0

What is the difference between these to ways of table creation.

CREATE TABLE TABLENAME(
field1....
field2...

add constraint constraint1;
add constraint constraint2;
)

AND

CREATE TABLE TABLENAME(
    field1....
    field2...
    )

ALTER TABLE TABLENAME add constaint1
ALTER TABLE TABLENAME add constaint2

Moreover the first scripts fails on the SQL+ but they pass on sqldeveloper
Thanks!
Pratik

  • 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-05-14T00:11:54+00:00Added an answer on May 14, 2026 at 12:11 am

    The difference seems to be that the first method is a single statement whereas the second one uses three distinct statements. IF the statements succeed, the overall result will be the same.

    You might want to check your synthax though (especially the use of “;”):

    SQL> CREATE TABLE table1 (
      2     field1 NUMBER,
      3     field2 NUMBER,
      4     CONSTRAINT pk_table1 PRIMARY KEY (field1),
      5     CONSTRAINT chk_table1 CHECK (field2 > 0)
      6  );     
    Table created
    
    SQL> CREATE TABLE table2 (
      2     field1 NUMBER,
      3     field2 NUMBER);     
    Table created
    
    SQL> ALTER TABLE table2 ADD CONSTRAINT pk_table2 PRIMARY KEY (field1);     
    Table altered
    
    SQL> ALTER TABLE table2 ADD CONSTRAINT chk_table2 CHECK (field2 > 0);     
    Table altered
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a difference between these two create table snippets? One includes CONSTRAINT keyword,
Is there a difference between these two ways of default checking a checkbox: document.getElementById(checkboxId).defaultChecked
What is the semantic difference between these 3 ways of using ivars and properties
What is the difference between these two ways of converting a string to System.Guid
In Javascript is there any difference between these two ways of adding a function
What is the difference between these two ways of checking the arguments? function foo(a,
Is there any difference between these two ways of querying the context? Firm firm
Is there any difference between following two ways of creating an object. Student s1
Will there be a difference between the following two ways of calling a function
Is there any difference between these tow pieces of code & which approach is

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.