ORACLE INTERVIEW QUESTION | How to Assign Row Numbers Without ROW_NUMBER() Function

 -- Create the employees table

DROP TABLE IF EXISTS employees;


CREATE TABLE employees (

    department_id INT,

    employee_id INT,

    name VARCHAR(50)

);


-- Insert sample data into the employees table

INSERT INTO employees (department_id, employee_id, name) VALUES

(1, 1, 'Anna'),

(1, 2, 'Ben'),

(2, 3, 'Charlie'),

(2, 4, 'David'),

(1, 5, 'Eva'),

(3, 6, 'George'),

(3, 7, 'John');



SELECT * FROM employees

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