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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:22:00+00:00 2026-05-30T14:22:00+00:00

a. Column Level GO CREATE TABLE Products ( ProductID INT CONSTRAINT pk_products_pid PRIMARY KEY,

  • 0

a. Column Level

GO

CREATE TABLE Products
(
ProductID INT CONSTRAINT pk_products_pid PRIMARY KEY,
ProductName VARCHAR(25)
);

GO

b. Table Level

CREATE TABLE Products
(
ProductID INT,
ProductName VARCHAR(25),
CONSTRAINT pk_products_pid PRIMARY KEY(ProductID)
);
GO 

Is their any difference between Column level and table level constraints?

  • 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-30T14:22:01+00:00Added an answer on May 30, 2026 at 2:22 pm

    No. It’s just a matter of personal taste how you apply the constraint.

    The primary key constraint is just a primary key constraint – it always applies to the table (after all: it could contain multiple columns – it cannot be “at the column level”).

    It’s not “at the column level” once or at the “table level” in the other case – it’s the same always.

    Just for fun – you can also create the primary key constraint a third way:

    (CREATE TABLE statement)
    GO
    
    ALTER TABLE dbo.Products
    ADD CONSTRAINT PK_Products_pid PRIMARY KEY(ProductID)
    

    and that again would be identical to the two other options you already have.

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

Sidebar

Related Questions

The column which defined with char type in a create table sentence is defined
A column with a foreign key to another table's column. How do I do
Is there any way I can add a column to a table but I
I have a SQL table: CREATE TABLE [UserTable] ( [ID] [int] NULL, [Name] [nvarchar](50)
I've created a compound unique index on my table: CREATE TABLE [dbo].[SearchIndexWord]( [ID] [int]
@Column(name=DateOfBirth) private Date dateOfBirth; I specifically need the above code to create a column
What column type in Oracle 10g can be used to store any value of
For an e-shop I have Products table (id, name, price, description) Attributes table (attribute
I really need a calculated column on a table with simple sum. Please see
I have a tree (nested categories) stored as follows: CREATE TABLE `category` ( `category_id`

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.