Effective use of ORDER BY Clause with examples | SQL Interview Question

 DML Script:

Problem 1: 

DROP TABLE IF EXISTS Results


CREATE TABLE Results

(

[ID] INT,

[Status] varchar(100)

)


INSERT INTO Results

VALUES

(1,'Pass'),

(2,'Pass'),

(3,'Pass'),

(4,'Fail'),

(5,'Fail'),

(6,'Fail') 



Problem 2: 

DROP TABLE IF EXISTS Place

CREATE TABLE Place
(
[city] varchar(100)
)

INSERT INTO Place
VALUES
('Delhi'), --1
('Mumbai'), --3
('Chennai'), --2
('Kolkata'),--4
('Hyderabad'),
('Pune'),
('Chandigarh'),
('Bangalore'),
('Agra'),
('Patna')

Detailed Explanation: 

Comments

Popular posts from this blog

50 Essential SQL Questions to Land Your Dream Job

How to find all the customers who placed orders on three consecutive days | SQL Scenario questions

ACCENTURE SQL INTERVIEW QUESTION | Change the ProductIDs