Oracle: SQL*Plus - One-column Primary key constraint Example | Description Each entity in a table must have a unique key field. It is chosen to uniquely identify a record so that it can be easily retrieved or processed. A statement that creates a table with one-column primary key constraint Example # 1 CREATE TABLE employee ( EmpID number (10), Emp_Name varchar2 (30) NOT NULL, Primary Key (EmpID) ) OR CREATE TABLE employee (EmpID number (10) Primary Key, Emp_Name varchar2 (30) NOT NULL ) Fig. 1.10 Description: The create table statement (as shown in figure 1.10) creates a table based on the column definitions One or more constraints can be assigned to a column or to the entire table Each column must have a unique name and must be assigned a data type ORACLE - PL/SQL Database - SQL* PLUS - Primay key (1 column)Database - SQL* PLUS - Crete TABLEDatabase - SQL* PLUS - For LoopsDatabase - SQL* PLUS - Primary key (two-column)Oracle PL/SQL - ProceduresDatabase - SQL* PLUS - Simple LoopDatabase - SQL* PLUS - While Loops
Example | Description
Each entity in a table must have a unique key field. It is chosen to uniquely identify a record so that it can be easily retrieved or processed.
A statement that creates a table with one-column primary key constraint
Example # 1
CREATE TABLE employee ( EmpID number (10), Emp_Name varchar2 (30) NOT NULL, Primary Key (EmpID) ) OR CREATE TABLE employee (EmpID number (10) Primary Key, Emp_Name varchar2 (30) NOT NULL )
CREATE TABLE employee
( EmpID number (10),
Emp_Name varchar2 (30) NOT NULL,
Primary Key (EmpID) )
OR
(EmpID number (10) Primary Key,
Emp_Name varchar2 (30) NOT NULL )
Fig. 1.10
Description:
The create table statement (as shown in figure 1.10) creates a table based on the column definitions
One or more constraints can be assigned to a column or to the entire table
Each column must have a unique name and must be assigned a data type
ORACLE - PL/SQL
Database - SQL* PLUS - Primay key (1 column)Database - SQL* PLUS - Crete TABLEDatabase - SQL* PLUS - For LoopsDatabase - SQL* PLUS - Primary key (two-column)Oracle PL/SQL - ProceduresDatabase - SQL* PLUS - Simple LoopDatabase - SQL* PLUS - While Loops
Home Disclaimer Advertise Contact Privacy Policy
Copyright © 2004-10 Paked.com. All rights reserved.
Note: Site best viewed at 1024 x 768 or higher screen resolution