Skip to main content
Open navigation menu
Close suggestions
Search
Search
en
Change Language, English
Upload
Sign in
Sign in
100%
(1)
100% found this document useful (1 vote)
58 views
9 pages
SQL Query Question
SQL question
Uploaded by
Shreya
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save SQL Query Question For Later
Share
100%
100% found this document useful, Mark this document as useful
0%
0% found this document not useful, Mark this document as not useful
Print
Embed
Report
100%
(1)
100% found this document useful (1 vote)
58 views
9 pages
SQL Query Question
SQL question
Uploaded by
Shreya
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Go to previous items
Download
Save
Save SQL Query Question For Later
Share
100%
100% found this document useful, Mark this document as useful
0%
0% found this document not useful, Mark this document as not useful
Print
Embed
Report
Go to next items
Download
* DDL, DMLCOMMANDS : CRUD operations + PRACTICE SELECT STATEMENT + FILTERS(HAVING, WHERE, IN, NOT IN ,BETWEEN) + AGGREGATION (GROUPBY, COUNT,SUM, MAX, MIN,AVG) * ORDER BY é& WILDCARDs + JOINS (INNER, LEFT, RIGHT, FULL, SELF, CROSS) + WINDOWS FUNCTION (RANK,ROW_NUMBER,DENSE_RANK,NTILE, CUME_DIST) + CASE STATEMENT * CTE,SUBQUERIES, TEMP TABLE ,RECURSIVE CTEs + LEAD,LAG, FIRST VALUE, LAST VALUE * STRING FUNCTIONS SQL Statements Execution order GROUP BY AGGREGATE FUNCTIONS HAVING pac JOINS Oh) aa ba Olgas a Faw Ke BL. Rea BCU ZAR leQ:We have one table sequence, write a SQL query to get the desired output. prere [Minseg Man Sea] A 1 3 A 6 A 8 9 8 1 n MAX_Seq from ( Select Name, sequence, sequence-ROW_NUMBER( Jover Q- Write 2 SQL query to get desired output. Input table : Airport Output: SOURCE Pane Eas Pe DELHI MuMeal DELHI MUMBAI DELHI PATNA MUMBAI DELHI BANGALORE PUNE DELHI PATNA CHANDIGARH CHENNAI BANGALORE = PUNE PUNE MUMBAI PUNE BANGALORE Goa HYDERABAD CHANDIGARH CHENNAI PUNE MUMBAL GREED [ess CASE WHEN SOURCE < DESTINATION THEN SOURCE ELSE GOA HYDERABAD IDESTINATION END AS SOURCE , ICASE WHEN SOURCE > DESTINATION THEN SOURCE ELSEQ: Write the SQL Query to get the desired output . Input Table: Employee Output: SE Anil Rajesh. 165000 i Vikas mann 16 7 Raman 62500 2 Nisha 40,000 18 18, Santosh 53750 3B Nidhi 60,000 v7 14 Priya 80,000 18 15 Mohit 45,000 18 16 Rajesh 90,000 - 17 Raman 55,000 16 18 Santosh 65,000.17 Q: Write a SQL query to get the desired output. Input Table : Rough Desired Output: 1 10 9 8 7 ©Q: Write a SQL query to get desired output ? Input Table : Salary Output : cos Ss nD Vishal Kaushal Vishal Kaushal 12000 Akshay Kumar 9000 Akshay Kumar 9000 Zishan Khan 3000 Zishan Khan 8000 Katrina Kaif 10000 Khan Zishan 5000 Katrina Kaif 10000.-«JSELECT FNAME, LNAME, S1+S2 AS TOTAL FROM ( SELECT [Link],[Link],[Link], ISNULL([Link],@) AS. oa Gs ene Kaushal Vishal 4000 * We have one table Demosales , write Sq! query to get desired output. Input :Demosales Desired Qutput : Ca Foren rod cout O01 PL 5 o1 PL 1 02 P2 1 o1 PL 1 03 P3 3 01 PL 1 o1 PL 1 o1 PL 1 o2 P2 1 03 P3 1 03 P3. 1 IORDER_BY ORDERID; 03 P3. 1Q: Write a SQL query to get the Desired output from Input Table. Output: Ee Finance 1 2 HR 1 3 7 2 1 Q: Write a SQL query to get the desired output (missing number from the input series) Input Output : (SELECT 1 AS SEQ. ( SELECT MAX(ID) FROM #MISSING_ROWS )AS SELECT SEQ+ ,MAXSEQ FROM CTE WHERE SEQ < MAXSEQ )| SELECT SEQ FROM CTE WHERE SEQ NOT IN (SELECT ID FROM Q: Write the SQL query to get the desired output. Input Table A, B Desired Output: SELECT * FROM #B HERE ID NOT IN (SELECT ID SBS Hs e+ e+e ofsolso + wae TEETHQ: Write SQL query to get the max value from Rows? Input Table : Maxrows Output: a kal S000 foo 0 Rahul 3500, 1000 2200, a Ro ‘Sukarn, 5600, 7757 8897 Se aan Select Name,Max(AMT) as Maxamt from (| iSelect Name,Amount_AS ANT from #maxro ISELECT Nane. | Q: Write SQL query to get desired output. input Table : Teams Output: AUSTRALIA — INDIA, INDIA AUSTRALIA— NEWZEALAND, AUSTRALIA AUSTRALIA ENGLAND ENGLAND ENGLAND- INDIA NEWZEALAND ENGLAND - NEWZEALAND INDIA - NEWZEALAND - '.[Link]) As MATCHES from #teamsQ: Write the SQL query to get the desired Output ? Input Table : Name Output io Name Ci 1 VISHAL, VISHAL. 2 VISHAL KAUSHAL 3 VISHAL VISHAL 4 KAUSHAL KAUSHAL 5 KAUSHAL VISHAL 6 KAUSHAL KAUSHAL Select Name, ROW_NUMBER() over (Partition by Name lorder by name) as RN Q: Write SQL query to get the desired output. Input Table : Attendance Output: oe
You might also like
Understanding SQL Subqueries
PDF
No ratings yet
Understanding SQL Subqueries
7 pages
Advanced SQL Lab Exercises Guide
PDF
No ratings yet
Advanced SQL Lab Exercises Guide
2 pages
SQL Practice Questions for Employees
PDF
No ratings yet
SQL Practice Questions for Employees
6 pages
Oracle SQL Queries for Employee Data
PDF
No ratings yet
Oracle SQL Queries for Employee Data
8 pages
SQL Query Practice Questions and Answers
PDF
No ratings yet
SQL Query Practice Questions and Answers
4 pages
Data Encoding and Compression Techniques
PDF
No ratings yet
Data Encoding and Compression Techniques
5 pages
SQL Queries for Employee and Student Data
PDF
No ratings yet
SQL Queries for Employee and Student Data
3 pages
SQL Commands and Syntax Guide
PDF
No ratings yet
SQL Commands and Syntax Guide
6 pages
SQL Keywords for Table Modifications
PDF
No ratings yet
SQL Keywords for Table Modifications
5 pages
SQL Practice Exercises for HR Database
PDF
100% (1)
SQL Practice Exercises for HR Database
40 pages
SQL Queries for Employee Data Analysis
PDF
No ratings yet
SQL Queries for Employee Data Analysis
28 pages
SQL SELECT Statement Examples and Errors
PDF
No ratings yet
SQL SELECT Statement Examples and Errors
5 pages
SQL Interview Questions and Answers
PDF
No ratings yet
SQL Interview Questions and Answers
4 pages
SQL Queries for Employee and Department Management
PDF
No ratings yet
SQL Queries for Employee and Department Management
16 pages
SQL JOIN Types and Subqueries Explained
PDF
No ratings yet
SQL JOIN Types and Subqueries Explained
9 pages
SQL/PLSQL Query Examples and Insights
PDF
No ratings yet
SQL/PLSQL Query Examples and Insights
89 pages
SQL Queries for Employee Data Analysis
PDF
100% (1)
SQL Queries for Employee Data Analysis
33 pages
SQL Queries for Employee Management
PDF
100% (1)
SQL Queries for Employee Management
10 pages
Employee Salary and Job Queries
PDF
No ratings yet
Employee Salary and Job Queries
15 pages
SQL Queries for Employee Data Analysis
PDF
No ratings yet
SQL Queries for Employee Data Analysis
0 pages
SQL Practice: Employee Management Queries
PDF
No ratings yet
SQL Practice: Employee Management Queries
11 pages
Primary Constraints in SQL Tables
PDF
No ratings yet
Primary Constraints in SQL Tables
126 pages
Oracle Functions and Operators Overview
PDF
No ratings yet
Oracle Functions and Operators Overview
17 pages
SQL Assignment Solutions for iLOGIC
PDF
No ratings yet
SQL Assignment Solutions for iLOGIC
7 pages
HR Schema Exercises Answers 11g
PDF
100% (1)
HR Schema Exercises Answers 11g
5 pages
SQL Basics and DML Overview
PDF
No ratings yet
SQL Basics and DML Overview
89 pages
Overview of SQL Operators and Usage
PDF
No ratings yet
Overview of SQL Operators and Usage
2 pages
SQL Database Exercises and Queries Guide
PDF
100% (1)
SQL Database Exercises and Queries Guide
4 pages
SQL Queries for Employee Management
PDF
No ratings yet
SQL Queries for Employee Management
19 pages
Understanding SQL Subqueries
PDF
No ratings yet
Understanding SQL Subqueries
4 pages
Employee Salary and Department Queries
PDF
0% (1)
Employee Salary and Department Queries
6 pages
SQL Assignment: Queries and Functions
PDF
No ratings yet
SQL Assignment: Queries and Functions
9 pages
SQL Character Functions Explained
PDF
No ratings yet
SQL Character Functions Explained
4 pages
Employees Without Department Assignment
PDF
No ratings yet
Employees Without Department Assignment
3 pages
Understanding Oracle Ref Cursors
PDF
No ratings yet
Understanding Oracle Ref Cursors
2 pages
DQL Commands for Database Queries
PDF
No ratings yet
DQL Commands for Database Queries
144 pages
Top SQL Interview Questions & Answers
PDF
No ratings yet
Top SQL Interview Questions & Answers
11 pages
UTL_FILE Usage in Oracle 10g
PDF
No ratings yet
UTL_FILE Usage in Oracle 10g
7 pages
SQL Left Join Examples in PySpark
PDF
No ratings yet
SQL Left Join Examples in PySpark
7 pages
Oracle SQL Single-Row Functions Guide
PDF
No ratings yet
Oracle SQL Single-Row Functions Guide
5 pages
SQL Emp Table Creation and Management
PDF
No ratings yet
SQL Emp Table Creation and Management
10 pages
SQL SELECT Statement Essentials
PDF
No ratings yet
SQL SELECT Statement Essentials
11 pages
Oracle SQL/PLSQL Interview Questions Guide
PDF
No ratings yet
Oracle SQL/PLSQL Interview Questions Guide
2 pages
SQL Server Date and Time Functions
PDF
No ratings yet
SQL Server Date and Time Functions
2 pages
Oracle HR Schema Table Structure Guide
PDF
No ratings yet
Oracle HR Schema Table Structure Guide
4 pages
SQL Queries for Employee Management
PDF
No ratings yet
SQL Queries for Employee Management
20 pages
SQL Practice Questions for Employees
PDF
No ratings yet
SQL Practice Questions for Employees
7 pages
Oracle Hierarchical Queries Explained
PDF
No ratings yet
Oracle Hierarchical Queries Explained
11 pages
Custom Stored Procedures in SQL
PDF
No ratings yet
Custom Stored Procedures in SQL
56 pages
SQL Queries for Employee Data Analysis
PDF
No ratings yet
SQL Queries for Employee Data Analysis
18 pages
SQL Query Interview Questions and Answers
PDF
No ratings yet
SQL Query Interview Questions and Answers
6 pages
HAVING Clause for Product Sales Analysis
PDF
No ratings yet
HAVING Clause for Product Sales Analysis
3 pages
Query Employees Under 25 at Entry
PDF
No ratings yet
Query Employees Under 25 at Entry
23 pages
SQL Practice: Employee Table Queries
PDF
No ratings yet
SQL Practice: Employee Table Queries
18 pages
SQL Queries for Employee and Department Data
PDF
No ratings yet
SQL Queries for Employee and Department Data
27 pages
SQL Scenario-Based Interview Questions
PDF
No ratings yet
SQL Scenario-Based Interview Questions
20 pages
Amazon Most Asked SQL Interview Questions CTC - 25lpa
PDF
No ratings yet
Amazon Most Asked SQL Interview Questions CTC - 25lpa
13 pages
Complex SQL Queries for Interviews
PDF
No ratings yet
Complex SQL Queries for Interviews
6 pages
Essential SQL Queries for Employees
PDF
No ratings yet
Essential SQL Queries for Employees
41 pages
Complex SQL Query Examples and Solutions
PDF
No ratings yet
Complex SQL Query Examples and Solutions
5 pages
ServiceNow Developer Resume: Manasa Guduru
PDF
No ratings yet
ServiceNow Developer Resume: Manasa Guduru
4 pages
Mounika Bavireddy: Power Apps Developer Resume
PDF
No ratings yet
Mounika Bavireddy: Power Apps Developer Resume
4 pages
Data Analysis for Land Investments
PDF
No ratings yet
Data Analysis for Land Investments
1 page
Alteryx Workflow Optimization Insights
PDF
100% (1)
Alteryx Workflow Optimization Insights
9 pages
Overview of DAX Function Types
PDF
No ratings yet
Overview of DAX Function Types
8 pages
PyCharm Multiple Cursors in Python Dev
PDF
No ratings yet
PyCharm Multiple Cursors in Python Dev
3 pages