Series: Subject: Topic:

SQL Interview Questions

Showing Questions 1 - 20 of 216 Questions
First | Prev | | Next | Last Page
Sort by: 

What is the output of the program, if integer occupies 2 bytes memory?Union{int a;char b;char c[10];}u1;void main(){int l=sizeof(u1);printf("%d",l);getch();}a. 13b. 10c. 16d. None of the above

Asked By: Interview Candidate | Asked On: Jun 19th, 2005


Answered by: Anjali Singh on: Oct 21st, 2014

Ans is 10 because union allocates memory for largest element only

Answered by: Bruce on: Nov 7th, 2006

D, It must 12 (the maximum is 10 but it had plus 2 (cause bounded memory)).

Data binding

Asked By: menak | Asked On: Nov 10th, 2010

Which type of binding does PL/SQL use?

Answered by: kanhaiya on: Oct 9th, 2014

Early binding

Get numeric values only using SQL ?

Asked By: sateesh44 | Asked On: Nov 24th, 2011

I have table with one column. Type varchar.. phone --------------- 99samn44423m44 8034skdf3453a2 909090abc4567d i want to get numeric values.. I mean my output will be phone --------------- 994442344 80343453a2 9090904567 thanks in advance.. sateesh

Answered by: stalink on: Sep 22nd, 2014

DECLARE @Temp VARCHAR(100)=(StalinKIN095815)
Declare @NumRange as varchar(50) = %[0-9]%
While PatIndex(@NumRange, @Temp) > 0
Set @Temp = Stuff(@Temp, PatIndex(@NumRange, @Temp), 1, )


Answered by: pradipta on: Jul 28th, 2014


How to retrieve a second highest salary from a table?

Asked By: BJMallinatha | Asked On: Jun 21st, 2012

How to retrieve a second highest salary from a table? note:suppose salaries are in duplicate values eg: name sal malli 60000 pandi 60000 rudra 45000 ravi 45000

Answered by: StalinK on: Sep 22nd, 2014

Table Name: Employee
Column name :Employee_id,First_name,Last_name,Salary

Select Employee_id,First_name,Last_name,Salary From
Select *,RANK() OVER ( Order by salary desc) as Test From employee
) A
Where Test=3

Answered by: jyotirmaya mohanty on: Apr 11th, 2014

Fetching Nth Highest Salary:

  1. SELECT * FROM Products P1
  2. WHERE (N-1) = (
  3. SELECT COUNT(P2.Price)
  4. FROM Products P2
  5. WHERE P2.Price > P1.Price);

What is the difference between SQL and SQL server?

Asked By: priyank singh pathania | Asked On: Sep 26th, 2005

Not known

Answered by: Trupti Das on: Sep 18th, 2014

SQL is a languagae & SQL Server is a database

Answered by: ramesh on: Jul 24th, 2014

Sql is a language and sql server is database

Difference between varchar and varchar2?

Asked By: Sreyas | Asked On: Feb 23rd, 2006

Star Read Best Answer

Editorial / Best Answer

Answered by: Ranjeet

Answered On : Feb 27th, 2006

Emp_name varchar(10) -  if you enter value less than 10 then remaining space can not be deleted. it used total 10 spaces.

Emp_name varchar2(10) - if you enter value less than 10 then remaining space is automatically deleted

Answered by: Trupti Das on: Sep 18th, 2014

Only difference is size limit.

Answered by: manojkumarkadiyala on: Jul 10th, 2014

Varchar is nothing but fixed length character data size min1 to max 2000
varchar2 is nothing but variable character data size min 1 to max 4000

SQL query

Asked By: venkateshm | Asked On: Feb 18th, 2014

What is SQL query to retrieve the second effective employees from job data for all the employees?

Answered by: sathis raja on: Sep 11th, 2014

We can get 2nd maximum salary of the employees.

Answered by: VIBHAV MISHRA on: Jun 30th, 2014

Select max(Sal) from Emp Where Sal not in(Select max(Sal) from Emp)

Demoralization is done toa. Check for data integrityb. Reduce data redundancyc. Introduce security checkd. Increase query performance

Asked By: Interview Candidate | Asked On: Jul 28th, 2005

Answered by: sweety on: Aug 23rd, 2014

Denormalization is done to increase query performance and
normalization is done to reduce data redundancy

Answered by: Bhoomika sharma on: Dec 16th, 2008

To increase the query performance thus demoralization is done.

One SQL statement which produces the following output

Asked By: sashelp | Asked On: May 20th, 2013

Department_id ,emp_count, dept_percentage

Answered by: VIBHAV MISHRA on: Jun 30th, 2014


How select query works in Oracle

Asked By: SaratKumar | Asked On: Oct 10th, 2005

When we give select * from emp; how does Oracle respond?

Answered by: Rakesh on: Jun 29th, 2014

Check for syntax correct Then it will check weather the table is present or not in database is nothing but a Parsing
fetch the data

Answered by: sainath on: Sep 24th, 2012

Syntax verification done from client only not in the server only valid sequel statements are send to the server if syntax is not correct client throws error

Is it possible to create user without using (create user) command ?

Asked By: dineshkrishnamca | Asked On: May 9th, 2011

Answered by: sekarh on: Apr 2nd, 2014


Answered by: smonroy on: Sep 27th, 2011

If you want is not created a user with command line, you should create it with the interface

Corelated query

Asked By: vivekvinayy | Asked On: Oct 26th, 2012

What is difference b/w coreleated subquery and nested subquery?

Answered by: pradeep on: Nov 21st, 2013

A outer query out put is input of inner query

Answered by: Vikas on: Jul 31st, 2013

Co-related sub query give reference to outer main query but nested sub query will have independent result set to be passed to outer query.

What is the real mean of foreign key?

Asked By: Rajat Pathak | Asked On: Sep 13th, 2013

Answered by: Aria Ansari on: Nov 12th, 2013

It is about referential integrity or making data both reliable and Secure. As an example by applying a foreign key constrain between customer and order tables It will not be allowed to create an order...

How to find the employee who get seventh largest salary in the company?

Asked By: mithrz | Asked On: Aug 19th, 2012

Answered by: dinesh on: Jul 23rd, 2013


Answered by: Amninder on: Apr 15th, 2013

Select emp_id,emp_name,salary from employee a, (Select salary,dense_Rank() over (order by salary DESC) rank_sal from employee)b where a.salary=b.salary and rank_sal=7; The Inline Query will orde...

Dml operations on base tables using a simple view

Asked By: hari.plsql | Asked On: Jan 25th, 2013

Can we make dml operations on base tables using a simple view?Can we insert or update or delete rows to the base tables using a view?

Answered by: lviswanath on: Jul 22nd, 2013

Of course we can do anything i.e. updating/deleting/inserting on a base table underlying a simple view, until unless its covering NOT NULL columns of the table in the query of the simple View.

Answered by: ppad001 on: Feb 27th, 2013

Yes we can use DML operations on single table view.

What is difference between DBMS and RDBMS?

Asked By: krishnamoorthy | Asked On: May 15th, 2006

Answered by: pradip on: May 26th, 2013

The primary difference between the DBMS and RDBMS we can add the foreign keys for relating the tables In dbms ,relation is between two files . while in rdbms relation is made between two tables. rdbms...

Answered by: parth on: Jan 28th, 2013

Dbms does not support client/server architecture and rdbms supports client/server architecture.

Normalization in SQL

Asked By: robindas | Asked On: Jan 16th, 2013

Explain the normalization and why it is done. Explain the case when we avoid the normalization in database.

Answered by: ppad001 on: Feb 27th, 2013

For perfomance optimization.
Like in case of datawarehousing operation the no of tables to be joined to get the desired output might be too high. In such a case we de-normalize to serve our purpose.

How to rename or change table name in SQL?

Asked By: shojol | Asked On: Mar 30th, 2012

Answered by: shikha on: Feb 3rd, 2013

Sp_RENAME old_table_name, new_table_name

Answered by: Gunjan David on: May 13th, 2012

SQL >> rename table_name1 to new_table_name;

What are steps to follow for query tuning ?

Asked By: thoufik | Asked On: Oct 27th, 2011

Answered by: robindas on: Jan 11th, 2013

Few steps for query tuning. 1) Check for if any sub query or exists or not exists is there if yes then try to change it in the joins 2) Try to check the way joins had been written try to put it in f...

Answered by: samareshoracle on: Aug 4th, 2012

Following a Tuning Methodology Objectives:: • Determine performance problems • Manage performance • Describe tuning methodologies • Identify goals for tuning • Describe automatic SQL tunin...

Difference between joins and subquery?

Asked By: Ratan satish | Asked On: Dec 6th, 2012

Why do we use joins, instead subquery has same operation?

Answered by: robindas on: Jan 11th, 2013

The subquery scan the complete table to apply so its slow whether joins are much faster.

Answered by: Koonal saxena on: Dec 20th, 2012

Joins are performance killer

First | Prev | | Next | Last Page





twitter fb Linkedin GPlus RSS


Interview Question

 Ask Interview Question?


Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.