About 11,200,000 results
Open links in new tab
  1. sql - Turn existing column into a primary key - Stack Overflow

    Oct 17, 2018 · create table emp ( emp_id int, emp_name varchar (40) not null, emp_address varchar (35) not null, ) Now I need to add primary key to emp_id . I tried using alter query alter …

  2. SQL PRIMARY KEY Constraint - W3Schools

    To allow naming of a PRIMARY KEY constraint, and for defining a PRIMARY KEY constraint on multiple columns, use the following SQL syntax: MySQL / SQL Server / Oracle / MS Access: …

  3. SQL Primary Key

    To create a primary key, you use the PRIMARY KEY constraint: For example, the following statement uses the CREATE TABLE statement to create a new table called projects with the …

  4. Create primary keys in SQL Server - SQL Server | Microsoft Learn

    Feb 4, 2025 · Creating a primary key in an existing table requires ALTER permission on the table. In Object Explorer, right-click the table to which you want to add a unique constraint, and …

  5. SQL PRIMARY KEY: How to Create & Add to Existing Table

    Jun 28, 2024 · This tutorial covers SQL Primary Key definitions, rules, How to add a primary key to an existing table in SQL, interesting facts, and more with detailed examples.

  6. How to Create a Primary Key in SQL - LearnSQL.com

    To create a new table with a column defined as the primary key, you can use the keyword PRIMARY KEY at the end of the definition of that column. In our example, we create the table …

  7. SQL PRIMARY KEY Constraint - GeeksforGeeks

    Dec 12, 2024 · There are two syntaxes to create/add primary key to a table: SQL primary key syntax with CREATE TABLE statement is: CONSTRAINT pk_constraint_name PRIMARY KEY …

  8. How to Add a Primary Key to an Existing SQL Table - dbvis.com

    May 13, 2025 · Learn to add a primary key to existing SQL tables with ALTER TABLE in SQL Server, MySQL, PostgreSQL, and Oracle.

  9. How to Add a Primary Key to an Existing Table in SQL Server (T-SQL

    Aug 5, 2019 · This article demonstrates how to add a primary key to an existing table in SQL Server using Transact-SQL. A primary key is a column that has been configured as the unique …

  10. SQL: Primary Keys - TechOnTheNet

    Let's look at an example of how to create a primary key using the CREATE TABLE statement in SQL. We will start with a very simple one where our primary key consists of just one column. …

  11. Some results have been removed