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 :: distinct in sql server 
Sql :: auto increment in postgresql 
Sql :: truncate psql 
Sql :: deleting database in sql 
Sql :: truncate your answer to decimal places mysql 
Sql :: sqlite select split string 
Sql :: oracle all dates between two dates 
Sql :: what is intersect in sql 
Sql :: convert html to plain text in sql server 
Sql :: add column alter table default value 
Sql :: postgres extract date from timestamp 
Sql :: installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1 
Sql :: python sqlite3 search 
Sql :: split string by comma in sql server 
Sql :: client does not support authentication protocol requested by server sqlyog 
Sql :: on update current_timestamp jpa 
Sql :: insert in sql 
Sql :: mysql where in maintain order group_concat 
Sql :: commit transaction sql 
Sql :: sql select whole row max column 
Sql :: oracle undo tablespace schema 
Sql :: cast in sql 
Sql :: Drop check constraint in ms sql 
Sql :: docker hub mysql 
Sql :: sql exemplos 
Sql :: disable trigger sql server 
Sql :: how to find first 3 highest salary in sql 
Sql :: set engine to innodb 
Sql :: oracle list chain steps 
Sql :: trunc sysdate in oracle 
ADD CONTENT
Topic
Content
Source link
Name
7+2 =