Search
 
SCRIPT & CODE EXAMPLE
 

SQL

oracle create table primary key

CREATE TABLE table_name
(
  column1 datatype null/not null,
  column2 datatype null/not null,
  ...
  CONSTRAINT constraint_name PRIMARY KEY (column1, column2, ... column_n)
);
Comment

identify primary key in oracle table

-- Primary key in a table
SELECT * FROM ALL_CONSTRAINTS 		-- or DBA_CONSTRAINTS or UESR_CONSTRAINTS
WHERE TABLE_NAME= 'table_name' AND CONSTRAINT_TYPE = 'P';
-- With columns names:
SELECT c.OWNER, c.TABLE_NAME, c.CONSTRAINT_NAME, c.CONSTRAINT_TYPE, 
	col.COLUMN_NAME
FROM ALL_CONSTRAINTS c
JOIN ALL_CONS_COLUMNS col ON c.TABLE_NAME = col.TABLE_NAME 
    AND c.CONSTRAINT_NAME = col.CONSTRAINT_NAME
WHERE c.TABLE_NAME= 'table_name' AND c.CONSTRAINT_TYPE = 'P'
ORDER BY c.TABLE_NAME, c.CONSTRAINT_NAME, col.COLUMN_NAME;
Comment

PREVIOUS NEXT
Code Example
Sql :: postgresql conectar 
Sql :: reset keys in sql 
Sql :: sql string function update replace 
Sql :: SQL Subtraction Operator 
Sql :: sql select inside select 
Sql :: sql primary key syntax 
Sql :: find mysql password 
Sql :: get table column names sql 
Sql :: add clumn to table postgres 
Sql :: SQL select example 
Sql :: How to get last inserted primary key in SQL Server 
Sql :: mysql if statement 
Sql :: osm2pgsql mac 
Sql :: postgresql concat string with separator 
Sql :: change schema in sql server 
Sql :: update value sql 
Sql :: how to get nth number in sql 
Sql :: reset postgres table index to next max value 
Sql :: tsql pad left 
Sql :: how to force truncate a table in mysql 
Sql :: mysql show slave status 
Sql :: 2nd highest value in sql 
Sql :: how to get max from each department in sql 
Sql :: what is non relational database 
Sql :: mysql default port number 
Sql :: how to recreate postgres database in docker 
Sql :: case condition in mongodb 
Sql :: how to generate ids in sql 
Sql :: mysql extract day from date leading zero 
Sql :: mysql workbench format date 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =