.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Interview Question >> Sql Server >> Post New Question Subscribe to Interview Questions

How do we get primary key information in oracle table?

Posted By :Dhivakaran     Posted Date :November 30, 2010    Points :10   Category :Sql Server 
we can get primary key information with the following SQL statement

SELECT b.table_name, b.column_name, b.position, a.status, cons.owner
FROM all_constraints a, all_cons_columns b
WHERE cons.constraint_type = 'P'
AND a.constraint_name = b.constraint_name
AND a.owner = b.owner
ORDER BY b.table_name, b.position;


You can also find related Interview Question to How do we get primary key information in oracle table?  below: 

What is the difference between unique and primary keys in Oracle SQL?

  
A table can have only one PRIMARY KEY whereas there can be any number of UNIQUE keys. The columns that compose PrimaryKey are automatically defined as NOT NULL, whereas a column that compose a UNIQUE is not automatically defined to be mandatory must also specify the column is NOT NULL.
(More...)

How To retrive Duplicate Records when There is no Primary key in a Table?

  
select city_name
from areas
group by city_name

having count(*) > 1 (More...)

How to get last five minuts records from Oracle Databse table?

  
select col_datetime,sysdate from tblname where trunc(col_datetime)=trunc(sysdate) and to_char(col_datetime,'dd-mm-yyyy hh24:mi:ss')>to_char(sysdate- interval '05' minute,'dd-mm-yyyy hh24:mi:ss')
(More...)

How can check the Oracle version information from the command prompt?

  
Version information is stored in a table called v$version. In this table we can find version information on Oracle, PL/SQL, etc.

To retrieve the version information for Oracle, we can execute the following SQL statement:

select * from v$version
where banner like 'Oracle%'; (More...)

Database: How many primary key constraints can be created for one table?

  
Only one primary key constraints can be created for one table. (More...)

How many Primary key in single table in sqlserver?

  
Primary key Restrict Duplicate Values and Null values .Each Table can have only one primary ..

Create table emp(empid int constraint pk_empid primary key(empid),empname varchar(90))

Regards
Sriram.R
www.databaseresource.blogspot.com (More...)

How to get basic SQL Server table structure information

  
sp_help will give you a whole bunch of information about a table including the columns, keys and constraints.

For example

exec sp_help 'Employee'

will give you information about table Employee. (More...)

What are the privileges that can be granted on a table by a user to others?

  
Insert, update, delete, select, references, index, execute, alter, all (More...)

What command is used to create a table by copying the structure of another table?

  
CREATE TABLE .. AS SELECT command

Explanation :

To copy only the structure, the WHERE clause of the SELECT command should contain a FALSE statement as in the following.
CREATE TABLE NEWTABLE AS SELECT * FROM EXISTINGTABLE WHERE 1=2;
If the WHERE condition is true, then all the rows or rows satisfying the condition will be copied to the new table. (More...)

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

 
Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.


Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend