SlideShare a Scribd company logo
Top 20 sql queries interview questions 
and answers 
If you need top 7 free ebooks below for your job interview, please visit: 
4career.net 
• Free ebook: 75 interview questions and answers 
• Top 12 secrets to win every job interviews 
• 13 types of interview quesitons and how to face them 
• Top 8 interview thank you letter samples 
• Top 7 cover letter samples 
• Top 8 resume samples 
• Top 15 ways to search new jobs 
Interview questions and answers – free pdf download Page 1 of 29
Tell me about yourself? 
This is probably the most asked 
question in sql queries interview. It 
breaks the ice and gets you to talk 
about something you should be fairly 
comfortable with. Have something 
prepared that doesn't sound rehearsed. 
It's not about you telling your life story 
and quite frankly, the interviewer just 
isn't interested. Unless asked to do so, 
stick to your education, career and 
current situation. Work through it 
chronologically from the furthest back 
to the present. 
Interview questions and answers – free pdf download Page 2 of 29
What is the difference between “delete” , 
“truncate” and “drop” commands 
Delete Command : Delete Command 
Belongs to DML 
Can be Used to delete entire Table data 
Can be used to delete specific rows using 
where clause 
Can be rolled back 
Truncate Command: Truncate Command 
Belongs to DDL 
Can be Used to delete entire Table data 
Can't be used to delete specific rows using 
where clause 
Can't be rolled back 
Drop Command: Drop Command Belongs 
to DDL 
Can be Used to delete entire Table data and 
also the structure Can't be used to delete 
specific rows using where clause 
Can't be rolled back 
Interview questions and answers – free pdf download Page 3 of 29
What Can You Do for Us That Other Candidates 
Can't? 
What makes you unique? This 
will take an assessment of 
your experiences, skills and 
traits. Summarize concisely: 
"I have a unique combination 
of strong technical skills, and 
the ability to build strong 
customer relationships. This 
allows me to use my 
knowledge and break down 
information to be more user-friendly." 
Interview questions and answers – free pdf download Page 4 of 29
What is the difference between primary key and 
unique key 
Unique Key: 
a.A table can contain more than one 
unique key 
b.Unique key allows one null value 
Primary Key: 
a.A table can contain only one primary 
key (can be one/more columns) 
b.Primary key will not allow null values 
Interview questions and answers – free pdf download Page 5 of 29
What is the difference between sub queries and 
joins 
a.Sub Queries : 
To write sub queries between two or 
more tables, there is no need to be 
relation exist among those tables 
b.Joins: 
To write joins between two or more 
tables, there should be relation exist 
among those tables 
Interview questions and answers – free pdf download Page 6 of 29
Write syntax for views and stored procedures 
View Syntax: 
Create view <view-name> as select 
<column names> from <table-name> 
where <condition> 
Stored Procedure Sysntax: 
Create procedure <procedure-name> 
as begin select <column names> from 
<table-name> end 
Note: These are only sample 
examples, we can write in different 
ways also. 
Interview questions and answers – free pdf download Page 7 of 29
What are the different constraints available in 
sql and Explain 
Not Null -> enforces a column to 
Not accept Null values 
Unique -> uniquely identifies each 
record in a database table 
Primary Key -> uniquely identifies 
each record in a database table and it 
cannot contain NULL values. 
Foreign Key -> A Foreign Key in one 
table points to a PRIMARY KEY in 
another table. 
Check -> It is used to limit the 
value range that can be placed in a 
column. 
Default -> It is used to insert a 
default value into a column. 
Interview questions and answers – free pdf download Page 8 of 29
By default how the column data would display if 
use order by <column> 
By default the order by would display 
the data in ascending order 
Syntax: 
a. select <col-names> from <table-name> 
order by <col-names> 
It will display the results in ascending 
order 
select <col-names> from <table-name> 
order by <col-names> desc 
It will display the results in descending 
order 
select <col-names> from <table-name> 
order by <col-names> asc 
It will display the results in ascending 
order 
Interview questions and answers – free pdf download Page 9 of 29
What is the operator in sql to find pattern match 
Like 
Select <colnames> from <table-name> 
where <col> like <pattern> 
Ex: 
a. 
Select ename from emp where ename 
like ‘v%’ 
It will display all the names which are 
start with ‘v’ 
b. 
Select ename from emp where ename 
not like ‘v%’ 
It will display other than all the names 
which are start with ‘v’ 
Interview questions and answers – free pdf download Page 10 of 29
What is the purpose of ‘distinct’ in sql 
Distinct is used to display only the 
different values 
Ex: 
Select distinct <col-names> from 
<table-name> 
Select distinct ename from emp 
Interview questions and answers – free pdf download Page 11 of 29
What is the difference between union and union 
all 
The UNION operator selects only distinct 
values by default. To allow duplicate 
values, use UNION ALL 
Select <col-names> from <table1> union 
select <col-names> from <table2> 
Select <col-names> from <table1> union 
all select <col-names> from <table2> 
Interview questions and answers – free pdf download Page 12 of 29
How can I find total number of employees with 
more than 40 years? 
SELECT 
COUNT(EMPLOYEES.*) FROM 
EMPLOYEES 
WHERE EMPLOYEES.Age>40 
Interview questions and answers – free pdf download Page 13 of 29
How to create Identity Column using Query? 
SELECT 
row_number() OVER(ORDER by 
TESTTABLE.p1) as SRNO, 
result=CASE 
WHEN TESTTABLE.p1 IS NOT 
NULL THEN TESTTABLE.p1 
WHEN TESTTABLE.p2 IS NOT 
NULL THEN TESTTABLE.p2 
END 
FROM TESTTABLE 
Interview questions and answers – free pdf download Page 14 of 29
How do I select 2nd highest salaried employee 
from my EMPLOYEE table? 
SELECT 
EMPLOYEE.*, 
MAX(EMPLOYEE.Salary) AS 
SalarySecondHighest 
FROM EMPLOYEE 
WHERE EMPLOYEE.Salary< 
(SELECT 
MAX(EMPLOYEE.Salary) AS 
SalaryFirstHighest 
FROM EMPLOYEE) 
Interview questions and answers – free pdf download Page 15 of 29
How to select top 3 employees from EMPLOYEE 
table which is grouped in the salary groups? 
SELECT 
EMPLOYEE.* 
FROM 
(SELECT EMPLOYEE.*, 
rank() OVER(PARTITION BY 
EMPLOYEE.Salary ORDER BY 
EMPLOYEE.Salary ASC) AS Rank 
from EMPLOYEE 
) EMPLOYEE 
where Rank<3 
-- if you want to top n employees for each 
grouped salary 
-- replace 3 in the query with (n+1) 
ORDER BY EMPLOYEE.Salary 
Interview questions and answers – free pdf download Page 16 of 29
How to find all the employees from EMPLOYEE 
table who earns more than the average salary of 
their department 
SELECT 
OUTEREMPLOYEE.*, 
OUTEREMPLOYEE.Salary 
FROM 
EMPLOYEE OUTEREMPLOYEE 
WHERE OUTEREMPLOYEE.Salary > 
(SELECT 
AVG(INNEREMPLOYEE.Salary) 
FROM 
EMPLOYEE INNEREMPLOYEE 
WHERE 
OUTEREMPLOYEE.DepartmentID = 
INNEREMPLOYEE.DepartmentID) 
Interview questions and answers – free pdf download Page 17 of 29
How to list employees with period of service in 
terms of years and months? 
SELECT 
EMPLOYEE.*,TO_CHAR(TRUNC( 
MONTHS_BETWEEN(SYSDATE, 
EMPLOYEE.HireDate)/12)) 
AS 
Years, TO_CHAR(TRUNC( MOD(MO 
NTHS_BETWEEN(SYSDATE, 
EMPLOYEE.HireDate),12))) AS Months 
FROM EMPLOYEE 
Interview questions and answers – free pdf download Page 18 of 29
How to display only Even Records from 
EMPLOYEE table? 
SELECT 
EMPLOYEE.* 
FROM EMPLOYEE 
WHERE (rowid,0) in 
(SELECT rowid,mod(rownum,2) 
FROM EMPLOYEE) 
Interview questions and answers – free pdf download Page 19 of 29
How to display only Odd Records from 
EMPLOYEE table? 
SELECT 
EMPLOYEE.* 
FROM EMPLOYEE 
WHERE (rowid,1) in 
(SELECT rowid,mod(rownum,2) 
FROM EMPLOYEE) 
Interview questions and answers – free pdf download Page 20 of 29
What are DDL and DML commands? 
DDL (DataDifinition Language): 
Create 
Alter 
Truncate 
Drop 
DML (Data Manipulation 
Language): 
Select 
Insert 
Update 
Deletet 
Interview questions and answers – free pdf download Page 21 of 29
Useful job interview materials: 
If you need top free ebooks below for your job interview, please visit: 
4career.net 
• Free ebook: 75 interview questions and answers 
• Top 12 secrets to win every job interviews 
• Top 36 situational interview questions 
• 440 behavioral interview questions 
• 95 management interview questions and answers 
• 30 phone interview questions 
• Top 8 interview thank you letter samples 
• 290 competency based interview questions 
• 45 internship interview questions 
• Top 7 cover letter samples 
• Top 8 resume samples 
• Top 15 ways to search new jobs 
Interview questions and answers – free pdf download Page 22 of 29
Top 6 tips for job interview 
Interview questions and answers – free pdf download Page 23 of 29
Tip 1: Do your homework 
You'll likely be asked difficult questions 
during the interview. Preparing the list of 
likely questions in advance will help you 
easily transition from question to question. 
Spend time researching the company. Look 
at its site to understand its mission statement, 
product offerings, and management team. A 
few hours spent researching before your 
interview can impress the hiring manager 
greatly. Read the company's annual report 
(often posted on the site), review the 
employee's LinkedIn profiles, and search the 
company on Google News, to see if they've 
been mentioned in the media lately. The 
more you know about a company, the more 
you'll know how you'll fit in to it. 
Ref material: 4career.net/job-interview-checklist- 
40-points 
Interview questions and answers – free pdf download Page 24 of 29
Tip 2: First impressions 
When meeting someone for the first time, we 
instantaneously make our minds about various aspects of 
their personality. 
Prepare and plan that first impression long before you 
walk in the door. Continue that excellent impression in 
the days following, and that job could be yours. 
Therefore: 
· Never arrive late. 
· Use positive body language and turn on your 
charm right from the start. 
· Switch off your mobile before you step into the 
room. 
· Look fabulous; dress sharp and make sure you look 
your best. 
· Start the interview with a handshake; give a nice 
firm press and then some up and down movement. 
· Determine to establish a rapport with the 
interviewer right from the start. 
· Always let the interviewer finish speaking before 
giving your response. 
· Express yourself fluently with clarity and 
precision. 
Useful material: 4career.net/top-10-elements-to-make-a- 
Interview questions and answers – free pdf download Page 25 of 29
good-first-impression-at-a-job-interview 
Tip 3: The “Hidden” Job Market 
Many of us don’t recognize that hidden job 
market is a huge one and accounts for 2/3 
of total job demand from enterprises. This 
means that if you know how to exploit a 
hidden job market, you can increase your 
chance of getting the job up to 300%. 
In this section, the author shares his 
experience and useful tips to exploit hidden 
job market. 
Here are some sources to get penetrating 
into a hidden job market: Friends; Family; 
Ex-coworkers; Referral; HR communities; 
Field communities; Social networks such 
as Facebook, Twitter…; Last recruitment 
ads from recruiters; HR emails of potential 
recruiters… 
Interview questions and answers – free pdf download Page 26 of 29
Tip 4: Do-It-Yourself Interviewing Practice 
There are a number of ways to prepare 
for an interview at home without the 
help of a professional career counselor 
or coach or a fee-based service. 
You can practice interviews all by 
yourself or recruit friends and family to 
assist you. 
Useful material: 4career.net/free-ebook- 
75-interview-questions-and-answers 
Interview questions and answers – free pdf download Page 27 of 29
Tip 5: Ask questions 
Do not leave the interview without 
ensuring that you know all that you 
want to know about the position. Once 
the interview is over, your chance to 
have important questions answered has 
ended. Asking questions also can show 
that you are interested in the job. Be 
specific with your questions. Ask about 
the company and the industry. Avoid 
asking personal questions of the 
interviewer and avoid asking questions 
pertaining to politics, religion and the 
like. 
Ref material: 4career.net/25-questions-to- 
ask-employers-during-your-job-interview 
Interview questions and answers – free pdf download Page 28 of 29
Tip 6: Follow up and send a thank-you note 
Following up after an interview can 
help you make a lasting impression and 
set you apart from the crowd. 
Philip Farina, CPP, a security career 
expert at Manta Security Management 
Recruiters, says: "Send both an email as 
well as a hard-copy thank-you note, 
expressing excitement, qualifications 
and further interest in the position. 
Invite the hiring manager to contact you 
for additional information. This is also 
an excellent time to send a strategic 
follow-up letter of interest." 
Ref material: 4career.net/top-8- 
interview-thank-you-letter-samples 
Interview questions and answers – free pdf download Page 29 of 29

More Related Content

Recently uploaded

The impact of social media on mental health and well-being has been a topic o...
The impact of social media on mental health and well-being has been a topic o...The impact of social media on mental health and well-being has been a topic o...
The impact of social media on mental health and well-being has been a topic o...sanghavirahi2
 
Salient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptxSalient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptxakshayaramakrishnan21
 
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General QuizPragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General QuizPragya - UEM Kolkata Quiz Club
 
The Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. HenryThe Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. HenryEugene Lysak
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleCeline George
 
An Overview of the Odoo 17 Discuss App.pptx
An Overview of the Odoo 17 Discuss App.pptxAn Overview of the Odoo 17 Discuss App.pptx
An Overview of the Odoo 17 Discuss App.pptxCeline George
 
Benefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational ResourcesBenefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational Resourcesdimpy50
 
How to the fix Attribute Error in odoo 17
How to the fix Attribute Error in odoo 17How to the fix Attribute Error in odoo 17
How to the fix Attribute Error in odoo 17Celine George
 
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...Nguyen Thanh Tu Collection
 
Open Educational Resources Primer PowerPoint
Open Educational Resources Primer PowerPointOpen Educational Resources Primer PowerPoint
Open Educational Resources Primer PowerPointELaRue0
 
[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online PresentationGDSCYCCE
 
The basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxThe basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxheathfieldcps1
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345beazzy04
 
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...Sayali Powar
 
Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportAvinash Rai
 
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxslides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxCapitolTechU
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...Nguyen Thanh Tu Collection
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePedroFerreira53928
 

Recently uploaded (20)

The impact of social media on mental health and well-being has been a topic o...
The impact of social media on mental health and well-being has been a topic o...The impact of social media on mental health and well-being has been a topic o...
The impact of social media on mental health and well-being has been a topic o...
 
Salient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptxSalient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptx
 
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General QuizPragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
 
The Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. HenryThe Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. Henry
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
An Overview of the Odoo 17 Discuss App.pptx
An Overview of the Odoo 17 Discuss App.pptxAn Overview of the Odoo 17 Discuss App.pptx
An Overview of the Odoo 17 Discuss App.pptx
 
Benefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational ResourcesBenefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational Resources
 
How to the fix Attribute Error in odoo 17
How to the fix Attribute Error in odoo 17How to the fix Attribute Error in odoo 17
How to the fix Attribute Error in odoo 17
 
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
 
NCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdfNCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdf
 
Open Educational Resources Primer PowerPoint
Open Educational Resources Primer PowerPointOpen Educational Resources Primer PowerPoint
Open Educational Resources Primer PowerPoint
 
[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation
 
The basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxThe basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptx
 
B.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdfB.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdf
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
 
Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training Report
 
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxslides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 

Featured

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 

Featured (20)

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 

Top sql queries interview questions and answers job interview tips

  • 1. Top 20 sql queries interview questions and answers If you need top 7 free ebooks below for your job interview, please visit: 4career.net • Free ebook: 75 interview questions and answers • Top 12 secrets to win every job interviews • 13 types of interview quesitons and how to face them • Top 8 interview thank you letter samples • Top 7 cover letter samples • Top 8 resume samples • Top 15 ways to search new jobs Interview questions and answers – free pdf download Page 1 of 29
  • 2. Tell me about yourself? This is probably the most asked question in sql queries interview. It breaks the ice and gets you to talk about something you should be fairly comfortable with. Have something prepared that doesn't sound rehearsed. It's not about you telling your life story and quite frankly, the interviewer just isn't interested. Unless asked to do so, stick to your education, career and current situation. Work through it chronologically from the furthest back to the present. Interview questions and answers – free pdf download Page 2 of 29
  • 3. What is the difference between “delete” , “truncate” and “drop” commands Delete Command : Delete Command Belongs to DML Can be Used to delete entire Table data Can be used to delete specific rows using where clause Can be rolled back Truncate Command: Truncate Command Belongs to DDL Can be Used to delete entire Table data Can't be used to delete specific rows using where clause Can't be rolled back Drop Command: Drop Command Belongs to DDL Can be Used to delete entire Table data and also the structure Can't be used to delete specific rows using where clause Can't be rolled back Interview questions and answers – free pdf download Page 3 of 29
  • 4. What Can You Do for Us That Other Candidates Can't? What makes you unique? This will take an assessment of your experiences, skills and traits. Summarize concisely: "I have a unique combination of strong technical skills, and the ability to build strong customer relationships. This allows me to use my knowledge and break down information to be more user-friendly." Interview questions and answers – free pdf download Page 4 of 29
  • 5. What is the difference between primary key and unique key Unique Key: a.A table can contain more than one unique key b.Unique key allows one null value Primary Key: a.A table can contain only one primary key (can be one/more columns) b.Primary key will not allow null values Interview questions and answers – free pdf download Page 5 of 29
  • 6. What is the difference between sub queries and joins a.Sub Queries : To write sub queries between two or more tables, there is no need to be relation exist among those tables b.Joins: To write joins between two or more tables, there should be relation exist among those tables Interview questions and answers – free pdf download Page 6 of 29
  • 7. Write syntax for views and stored procedures View Syntax: Create view <view-name> as select <column names> from <table-name> where <condition> Stored Procedure Sysntax: Create procedure <procedure-name> as begin select <column names> from <table-name> end Note: These are only sample examples, we can write in different ways also. Interview questions and answers – free pdf download Page 7 of 29
  • 8. What are the different constraints available in sql and Explain Not Null -> enforces a column to Not accept Null values Unique -> uniquely identifies each record in a database table Primary Key -> uniquely identifies each record in a database table and it cannot contain NULL values. Foreign Key -> A Foreign Key in one table points to a PRIMARY KEY in another table. Check -> It is used to limit the value range that can be placed in a column. Default -> It is used to insert a default value into a column. Interview questions and answers – free pdf download Page 8 of 29
  • 9. By default how the column data would display if use order by <column> By default the order by would display the data in ascending order Syntax: a. select <col-names> from <table-name> order by <col-names> It will display the results in ascending order select <col-names> from <table-name> order by <col-names> desc It will display the results in descending order select <col-names> from <table-name> order by <col-names> asc It will display the results in ascending order Interview questions and answers – free pdf download Page 9 of 29
  • 10. What is the operator in sql to find pattern match Like Select <colnames> from <table-name> where <col> like <pattern> Ex: a. Select ename from emp where ename like ‘v%’ It will display all the names which are start with ‘v’ b. Select ename from emp where ename not like ‘v%’ It will display other than all the names which are start with ‘v’ Interview questions and answers – free pdf download Page 10 of 29
  • 11. What is the purpose of ‘distinct’ in sql Distinct is used to display only the different values Ex: Select distinct <col-names> from <table-name> Select distinct ename from emp Interview questions and answers – free pdf download Page 11 of 29
  • 12. What is the difference between union and union all The UNION operator selects only distinct values by default. To allow duplicate values, use UNION ALL Select <col-names> from <table1> union select <col-names> from <table2> Select <col-names> from <table1> union all select <col-names> from <table2> Interview questions and answers – free pdf download Page 12 of 29
  • 13. How can I find total number of employees with more than 40 years? SELECT COUNT(EMPLOYEES.*) FROM EMPLOYEES WHERE EMPLOYEES.Age>40 Interview questions and answers – free pdf download Page 13 of 29
  • 14. How to create Identity Column using Query? SELECT row_number() OVER(ORDER by TESTTABLE.p1) as SRNO, result=CASE WHEN TESTTABLE.p1 IS NOT NULL THEN TESTTABLE.p1 WHEN TESTTABLE.p2 IS NOT NULL THEN TESTTABLE.p2 END FROM TESTTABLE Interview questions and answers – free pdf download Page 14 of 29
  • 15. How do I select 2nd highest salaried employee from my EMPLOYEE table? SELECT EMPLOYEE.*, MAX(EMPLOYEE.Salary) AS SalarySecondHighest FROM EMPLOYEE WHERE EMPLOYEE.Salary< (SELECT MAX(EMPLOYEE.Salary) AS SalaryFirstHighest FROM EMPLOYEE) Interview questions and answers – free pdf download Page 15 of 29
  • 16. How to select top 3 employees from EMPLOYEE table which is grouped in the salary groups? SELECT EMPLOYEE.* FROM (SELECT EMPLOYEE.*, rank() OVER(PARTITION BY EMPLOYEE.Salary ORDER BY EMPLOYEE.Salary ASC) AS Rank from EMPLOYEE ) EMPLOYEE where Rank<3 -- if you want to top n employees for each grouped salary -- replace 3 in the query with (n+1) ORDER BY EMPLOYEE.Salary Interview questions and answers – free pdf download Page 16 of 29
  • 17. How to find all the employees from EMPLOYEE table who earns more than the average salary of their department SELECT OUTEREMPLOYEE.*, OUTEREMPLOYEE.Salary FROM EMPLOYEE OUTEREMPLOYEE WHERE OUTEREMPLOYEE.Salary > (SELECT AVG(INNEREMPLOYEE.Salary) FROM EMPLOYEE INNEREMPLOYEE WHERE OUTEREMPLOYEE.DepartmentID = INNEREMPLOYEE.DepartmentID) Interview questions and answers – free pdf download Page 17 of 29
  • 18. How to list employees with period of service in terms of years and months? SELECT EMPLOYEE.*,TO_CHAR(TRUNC( MONTHS_BETWEEN(SYSDATE, EMPLOYEE.HireDate)/12)) AS Years, TO_CHAR(TRUNC( MOD(MO NTHS_BETWEEN(SYSDATE, EMPLOYEE.HireDate),12))) AS Months FROM EMPLOYEE Interview questions and answers – free pdf download Page 18 of 29
  • 19. How to display only Even Records from EMPLOYEE table? SELECT EMPLOYEE.* FROM EMPLOYEE WHERE (rowid,0) in (SELECT rowid,mod(rownum,2) FROM EMPLOYEE) Interview questions and answers – free pdf download Page 19 of 29
  • 20. How to display only Odd Records from EMPLOYEE table? SELECT EMPLOYEE.* FROM EMPLOYEE WHERE (rowid,1) in (SELECT rowid,mod(rownum,2) FROM EMPLOYEE) Interview questions and answers – free pdf download Page 20 of 29
  • 21. What are DDL and DML commands? DDL (DataDifinition Language): Create Alter Truncate Drop DML (Data Manipulation Language): Select Insert Update Deletet Interview questions and answers – free pdf download Page 21 of 29
  • 22. Useful job interview materials: If you need top free ebooks below for your job interview, please visit: 4career.net • Free ebook: 75 interview questions and answers • Top 12 secrets to win every job interviews • Top 36 situational interview questions • 440 behavioral interview questions • 95 management interview questions and answers • 30 phone interview questions • Top 8 interview thank you letter samples • 290 competency based interview questions • 45 internship interview questions • Top 7 cover letter samples • Top 8 resume samples • Top 15 ways to search new jobs Interview questions and answers – free pdf download Page 22 of 29
  • 23. Top 6 tips for job interview Interview questions and answers – free pdf download Page 23 of 29
  • 24. Tip 1: Do your homework You'll likely be asked difficult questions during the interview. Preparing the list of likely questions in advance will help you easily transition from question to question. Spend time researching the company. Look at its site to understand its mission statement, product offerings, and management team. A few hours spent researching before your interview can impress the hiring manager greatly. Read the company's annual report (often posted on the site), review the employee's LinkedIn profiles, and search the company on Google News, to see if they've been mentioned in the media lately. The more you know about a company, the more you'll know how you'll fit in to it. Ref material: 4career.net/job-interview-checklist- 40-points Interview questions and answers – free pdf download Page 24 of 29
  • 25. Tip 2: First impressions When meeting someone for the first time, we instantaneously make our minds about various aspects of their personality. Prepare and plan that first impression long before you walk in the door. Continue that excellent impression in the days following, and that job could be yours. Therefore: · Never arrive late. · Use positive body language and turn on your charm right from the start. · Switch off your mobile before you step into the room. · Look fabulous; dress sharp and make sure you look your best. · Start the interview with a handshake; give a nice firm press and then some up and down movement. · Determine to establish a rapport with the interviewer right from the start. · Always let the interviewer finish speaking before giving your response. · Express yourself fluently with clarity and precision. Useful material: 4career.net/top-10-elements-to-make-a- Interview questions and answers – free pdf download Page 25 of 29
  • 26. good-first-impression-at-a-job-interview Tip 3: The “Hidden” Job Market Many of us don’t recognize that hidden job market is a huge one and accounts for 2/3 of total job demand from enterprises. This means that if you know how to exploit a hidden job market, you can increase your chance of getting the job up to 300%. In this section, the author shares his experience and useful tips to exploit hidden job market. Here are some sources to get penetrating into a hidden job market: Friends; Family; Ex-coworkers; Referral; HR communities; Field communities; Social networks such as Facebook, Twitter…; Last recruitment ads from recruiters; HR emails of potential recruiters… Interview questions and answers – free pdf download Page 26 of 29
  • 27. Tip 4: Do-It-Yourself Interviewing Practice There are a number of ways to prepare for an interview at home without the help of a professional career counselor or coach or a fee-based service. You can practice interviews all by yourself or recruit friends and family to assist you. Useful material: 4career.net/free-ebook- 75-interview-questions-and-answers Interview questions and answers – free pdf download Page 27 of 29
  • 28. Tip 5: Ask questions Do not leave the interview without ensuring that you know all that you want to know about the position. Once the interview is over, your chance to have important questions answered has ended. Asking questions also can show that you are interested in the job. Be specific with your questions. Ask about the company and the industry. Avoid asking personal questions of the interviewer and avoid asking questions pertaining to politics, religion and the like. Ref material: 4career.net/25-questions-to- ask-employers-during-your-job-interview Interview questions and answers – free pdf download Page 28 of 29
  • 29. Tip 6: Follow up and send a thank-you note Following up after an interview can help you make a lasting impression and set you apart from the crowd. Philip Farina, CPP, a security career expert at Manta Security Management Recruiters, says: "Send both an email as well as a hard-copy thank-you note, expressing excitement, qualifications and further interest in the position. Invite the hiring manager to contact you for additional information. This is also an excellent time to send a strategic follow-up letter of interest." Ref material: 4career.net/top-8- interview-thank-you-letter-samples Interview questions and answers – free pdf download Page 29 of 29