About 6,590,000 results
Open links in new tab
  1. How do you list the primary key of a SQL Server table?

    Sep 18, 2008 · If you want to get the primary key for a specific table, then you need to filter on SchemaName and TableName. IMHO, this solution is very generic and does not use any …

  2. SQL query to find Primary Key of a table? - Stack Overflow

    Sep 11, 2012 · For MySQL: SELECT GROUP_CONCAT(COLUMN_NAME), TABLE_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_SCHEMA = …

  3. SQL Query to Check or Find the Column Name Which Is Primary Key

    Apr 8, 2021 · To find PRIMARY KEY of any table : SELECT K.COLUMN_NAME FROM. INFORMATION_SCHEMA.TABLE_CONSTRAINTS T. JOIN …

  4. SQL Server: Get table primary key using sql query

    Oct 14, 2010 · I want to get a particular table's primary key using SQL query for SQL Server database. In MySQL I am using following query to get table primary key: SHOW KEYS FROM …

  5. How To Get The Primary Key Of A Table In SQL Server

    Nov 18, 2024 · We can execute the below SQL query to retrieve the primary key column details of the Order table. c.TABLE_NAME AS TableName, COLUMN_NAME AS PrimaryKeyColumn. …

  6. SQL PRIMARY KEY Constraint - W3Schools

    SQL PRIMARY KEY Constraint The PRIMARY KEY constraint uniquely identifies each record in a table. Primary keys must contain UNIQUE values, and cannot contain NULL values. A table …

  7. 11 Ways to Retrieve a Primary Key in SQL Server (T-SQL Examples)

    Aug 11, 2019 · Retrieving all primary keys from a database (or even just the primary key for a given table) is a case in point. This article presents eleven different approaches to retrieving …

  8. 5 Ways to Find a Table’s Primary Key in MySQL - Database.Guide

    Mar 21, 2024 · In MySQL we can use the SHOW KEYS statement to get the primary key for a given table: Example result: Primary keys always have a Key_name of PRIMARY, and so …

  9. Retrieving Table Primary Key With SQL Queries - Baeldung

    Aug 28, 2024 · Learn how to retrieve a table's primary key with SQL queries in MySQL, PostgreSQL, and SQL Server.

  10. 3 Ways to Find a Table’s Primary Key Constraint Name in SQL

    Oct 6, 2024 · One way to find the primary key constraint name is by querying the information schema. Here’s a SQL query that can help you retrieve this information: constraint_name. …

  11. Some results have been removed
Refresh