GeekInterview.com
Series: Subject: Topic:

SQL Interview Questions

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

One SQL statement which produces the following output

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

Department_id ,emp_count, dept_percentage

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

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

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...

Answered by: gowtham on: Oct 1st, 2012

select salary data only

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: ppad001 on: Feb 27th, 2013

Yes we can use DML operations on single table view.

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 is difference between DBMS and RDBMS?

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

Answered by: parth on: Jan 28th, 2013

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

Answered by: Gaya on: Jun 5th, 2012

Eg for DBMS is FoxPro,IMS... For RDBMS is SQL,ORACLE...

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

SQL query to change lower case in a table to upper case

Asked By: venkat2604 | Asked On: Nov 29th, 2012

In a table the persons name is in lower case "abc" and is there any SQL query to obtain that persons name as "abc" as an output?

Answered by: Muzeeb on: Jan 6th, 2013

Yes, using SQL UPPER function.

Code
  1. SELECT UPPER(name) FROM TABLE;

State true or false. !=, <>, ^= all denote the same operation.

Asked By: Interview Candidate | Asked On: Mar 6th, 2005

True

Answered by: Guru on: Dec 19th, 2012

True

Answered by: Durgesh Kumar Singore on: Feb 7th, 2012

In SQL 2005 only != and <> operator perform same operation

^= does not work

Difference between cluster and non-cluster index?

Asked By: bsush | Asked On: Oct 17th, 2006

Star Read Best Answer

Editorial / Best Answer

Answered by: Sushant

Answered On : Oct 25th, 2006

The difference is that, Clustered index is unique for any given table and we can have only one clustered index on a table. The leaf level of a clustered index is the actual data and the data is resorted in case of clustered index. Whereas in case of non-clustered index the leaf level is actually a pointer to the data in rows so we can have as many non-clustered indexes as we can on the db.

Answered by: Sameer on: Nov 1st, 2012

now SQL SERVER 2008 onwards we can have 1 cluster index and 999 non cluster index on one table.

Answered by: primarykey2000 on: Apr 22nd, 2008

clustered index  - the index order matches the order of physically stored data.cluster index can be used on table that doent get changes frequentlyusing DML statement on cluster index column have...

Corelated query

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

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

Can we call a function containing dml statements in a select query?

Asked By: divyaanand83 | Asked On: Aug 26th, 2012

Answered by: V.E.Rajani on: Oct 3rd, 2012

Only SELECT statement can be used in Functions. INSERT,UPDATE,DELETE are used.

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: 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

Answered by: Sathya on: Sep 23rd, 2012

It will fetch all the data from employee table..then u give a select * command..

What is the difference between SQL and SQL server?

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

Not known

Answered by: ramya on: Sep 1st, 2012

sql is a language
sql server is a RDBMS relational database management system.

Answered by: Rakesh Kumar on: Jun 24th, 2012

Sql Server is a (RDBMS) Relation Database Management System where as SQL is Structure Query Language.

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: Abhishek on: Aug 23rd, 2012

"sql declare @temp_numeric table (value nvarchar(500)) declare @i int=1,@len int,@ans nvarchar(100)=,@str nvarchar(100) DECLARE @count INT SELECT VALUE INTO #temp FROM dbo.numer...

Answered by: naga on: Mar 12th, 2012

Code
  1. SELECT REPLACE(TRANSLATE(LOWER(99sAmn44423mz44),abcdefghijklmnopqrstuvwxyz, ), ,) FROM dual

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: NagaRaja on: Aug 17th, 2012

Select Max(Salary) from Emp Where Salary < (Select Max(Salary) from Emp)

Answered by: purvi on: Aug 7th, 2012

select max(salary) from EmpTable where salary not in (select max(salary) from EmpTable));

How write a SQL statement to query the result set and display row as columns and columns as row?

Asked By: unknownly9 | Asked On: Apr 6th, 2006

Answered by: ratnam on: Aug 3rd, 2012

How write a SQL statement to query the result set and display row as columns and columns as row?

Answered by: Vasanth Kumar on: Oct 6th, 2006

The simplest way to implement this in SQL 2000/OracleSelect * from table1Create a temp table with No of columns = No of rows in table 1No of rows = No of columns in table 1and insert the data into the temp table using a loop logic.

Difference between varchar and varchar2?

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

Star Read Best Answer

Editorial / Best Answer

Answered by: muralidhar_batta

View all answers by muralidhar_batta

Member Since Feb-2006 | Answered On : Feb 26th, 2006

varchar means fixed length character data(size) ie., min size-1 and max-2000

where as varchar2 means variable length character data ie., min-1 to max-4000

Answered by: Ravi on: Jul 13th, 2012

Varchar & Varchar2 both having the same size, & working as same.
Bt the main diff is varchar is an ANSI Datatype & Varchar2 is the Oracle datatype.

Answered by: pooja manoja on: Feb 4th, 2012

Varchar - If we declare datatype as varchar then it will occupy space for null values. It can store upto 2000 bytes of character.

Varchar2 - If we declare datatype as varchar2, it will not occupy any space. It can store 4000 bytes of character.

Thanx,

Count records

Asked By: abhi.mys1111 | Asked On: Jun 15th, 2012

I have following table as books101 book_no book_name author_name cost category1234 c dennis 450 system1235 Oracle loni 550 database1236 sql loni 250 database1237 PL/SQL scott 750 database now I want to list all the authors and book name that has more then 1 book written by them.Pls help

Answered by: Avinash on: Jun 24th, 2012

select AUTHOR_NAME,BOOK_NAME from books101
where AUTHOR_NAME in
(select author_name from books101 group by author_name having count(*)>1);

Answered by: kannandevan on: Jun 15th, 2012

select book_name,author_name,count(*) from books
group by book_name,author_name
having count(*)>1

First | Prev | | Next | Last Page

 

 

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Ads

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.