GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  Oracle  >  SQL
Go To First  |  Previous Question  |  Next Question 
 SQL  |  Question 160 of 169    Print  
Column Level Constraint
What are Column Level Constraint and Table Level Constraint? How do they differ from one another?


  
Total Answers and Comments: 2 Last Update: June 10, 2008     Asked by: ravi.allam9 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
June 10, 2008 07:00:38   #1  
dineshchaini Member Since: August 2006   Contribution: 6    

RE: Column Level Constraint
Table Level Constraint

CREATE TABLE supplier_item ( supp_no INTEGER NOT NULL, item_no INTEGER NOT NULL, qty INTEGER NOT NULL DEFAULT 0, PRIMARY KEY (supp_no, item_no) ) ;

In the above example you can see that the table is already created and in the end of the statement we provide the Primary key constraint, So its like creating table and end of the statement we defind the constraint. The Supp_no and item no are primary key defined at last.. That is what Table level constraint is.

And the normally when we are creating the table beside eack column we can mention the constraint indivisually called the column level constraint

Example of Column level constraint

CREATE TABLE supplier_item ( supp_no INTEGER NOT NULL PRIMARY KEY, item_no INTEGER NOT NULL, qty INTEGER NOT NULL DEFAULT 0 ;

 
Is this answer useful? Yes | No
June 10, 2008 23:56:16   #2  
sravee123 Member Since: May 2008   Contribution: 16    

RE: Column Level Constraint
Table level constraint:

Ex: create table emp(empno integer,ename varchar(20),deptno integer,primary key(empno))

column level constraint:

create table emp(empno integer primary key,ename varchar(20),deptno integer)



In table level need create constraint at end of the table, where as in column level need to declare the constraint after the column declaration.

 
Is this answer useful? Yes | No

 Related Questions

Rename is a permanent name given to a table or column whereas Alias is a temporary name given to a table or column which do not exist once the SQL statement is executed. 
Latest Answer : Rename means give the new name to existed objects alise is use to refrence to objects ...

A table can have only one PRIMARY KEY whereas there can be any number of UNIQUE keys. The columns that compose PK are automatically define NOT NULL, whereas a column that compose a UNIQUE is not automatically 
Latest Answer : Primay Key                     Unique key-----------                  ...

'' Should be used before '%'. 
Latest Answer : select * from emp where instr('ename','%')!=0 ...

SELECT * FROM empWhere emp_no+' '=12345;i.e you have to concatenate the column name with space within codes in the where condition.SELECT /*+ FULL(a) */ ename, emp_no from empwhere emp_no=1234;i.e 
Latest Answer : Its so distressing that no body could provide a better answer than a novice like me.In the where clause change the order of conditions in such a way that:  5 = value cond1 & value =5or value + 1 = 5 ...

It is a column that is not an actual column in the table.eg USER, UID, SYSDATE, ROWNUM, ROWID, NULL, AND LEVEL. 
Latest Answer : Pseudo columns is not actula column in the table. it behaves like table columnwe can retivesv values of pseduo column but can not insert,update or delete value in that.has two data type 1. rowid  2. urowidrow id uniqely identify row in databaseEXM ...

select level, min('col_name') from my_table where level = '&n' connect by prior ('col_name')  
Latest Answer : TO find out nth LOWEST value, e.g. salary from emp table without using ROWNUM & DESC/ASCSELECT DISTINCT (a.sal) FROM EMP A WHERE &N = (SELECT COUNT (DISTINCT (b.sal))                        ...

select level, max('col_name') from my_table where level = '&n' connect by prior ('col_name') >'col_name')group by level;Example:Given a table called emp with 
Latest Answer : SELECT MAX () FROM WHERE IN (SELECT TOP n FROM ORDER BY ASC)OR SELECT MIN () FROM WHERE IN (SELECT TOP n FROM ORDER BY DESC) ...

What a SELECT FOR UPDATE cursor represent.[ANSWER]SELECT......FROM......FOR......UPDATE[OF column-reference][NOWAIT] The processing done in a fetch loop modifies the rows that have been retrieved by the cursor. A convenient way of modifying the rows is done by a method with two parts: the FOR UPDATE clause in the cursor declaration, WHERE CURRENT OF CLAUSE in an UPDATE or declaration statement.

Data base trigger(DBT) fires when a DML operation is performed on a data base table. Form trigger(FT) Fires when user presses a key or navigates between fields on the screenCan be row level or statement 
Latest Answer : Database Trigger: We can't invoke a Form Trigger in DatabaseFrom Trigger: We can invoke a Database Trigger in Forms ...

Merge Join :Oracle performs a join between two sets of row data  using the mergejoin algorithm. The inputs are two separate sets of row data. Output isthe results of the join.  Oracle reads rows 
Latest Answer : Merge Joins Sort merge joins can be used to join rows from two independent sources. Hash joins generally perform better than sort merge joins. On the other hand, sort merge joins can perform better than hash joins if both of the following conditions exist:The ...


 Sponsored Links

 
Related Articles

Querying Data with Oracle XQuery

Querying Data with Oracle XQuery Starting with Oracle Database 10g Release 2 you can take advantage of a full featured native XQuery engine integrated with the database With Oracle XQuery you can accomplish various tasks involved in developing PHP Oracle XML applications operating on any kind of dat
 

Using Oracle XML DB Repository

Using Oracle XML DB Repository Another variation on accessing and manipulating XML content stored in Oracle database is provided by Oracle XML DB repository which is an essential component of Oracle XML DB mosgoogle NOTE Oracle XML DB repository also known as XML repository is a hierarchically organ
 

Using Oracle Database for Storing, Modifying, and Retrieving XML Data

Using Oracle Database for Storing Modifying and Retrieving XML Data With Oracle XML DB you have various XML storage and XML processing options allowing you to achieve the required level of performance and scalability One of the most interesting things about Oracle XML DB is that it allows you to per
 

XML Processing in PHP and Oracle Applications

Processing XML in PHP Oracle Applications As mentioned there are two alternatives when it comes to performing XML processing in your PHP Oracle application You can perform any required XML processing using either PHP s XML extensions or PEAR XML packages or Oracle s XML features mosgoogle In the fol
 

PHP Oracle Web Development

PHP Oracle Web Development Data processing Security Caching XML Web Services and Ajax The book is written by Yuli Vaseliev a well known author of different web development and programming books PHP Oracle Web Development Data processing Security Caching XML Web Services and Ajax is a good starting b
 

Getting Started with Oracle and ODP.NET

ODP NET Developer’ s Guide by Jagadish Chatarji Pulakhandam Sunitha Paruchuri A practical guide for developers working with the Oracle Data Provider for NET and the Oracle Developer Tools for Visual Studio 2005 Application development with ODP NET Dealing with XML DB using ODP NET Oracle
 

PHP Oracle Web Development Review

PHP Oracle Web Development Data processing Security Caching XML Web Services and Ajax The book is written by Yuli Vaseliev a well known author of different web development and programming books The author is also an expert in open source technologies and SOA Service Oriented Architecture But besides
 

High Level Data Link Control (HDLC)

High Level Data Link Control HDLC The High Level Data Link Control protocol was developed by the International Organization for Standardization ISO It is used for switched and non switched networks and is a bit oriented architecture The High Level Data Link Control has been accepted and used widel
 

jQuery - Column Highlighting

Learning jQuery Column Highlighting It can be a nice user interface enhancement to visually remind the user of what has been done in the past By highlighting the column that was most recently used for sorting we can focus the user s attention on the part of the table that is most likely to be releva
 

Step by Step Oracle PL-SQL Tutorial

This introductory tutorial to PL SQL will help you to understand the basic concepts of PL SQL Please review the following tutorials and practice the sample SQL Statements on your local Oracle Database Please note that you must learn these basic things before we actually start getting in to Advanced
 

Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape