AMAZON INTERVIEW QUESTION | Dynamic Score Calculation Without Updates | SQL INTERVIEW

 DML Script:


DROP TABLE IF EXISTS Grades


CREATE TABLE Grades (

    Subject VARCHAR(50),

    Score INT

);


INSERT INTO Grades (Subject, Score) VALUES

('Math', 95),

('Science', 88),

('History', 92),

('English', 85),

('Geography', 90),

('Biology', 87),

('Chemistry', 91),

('Physics', 89),

('Social',95)


DROP TABLE IF EXISTS SubjectMapping


CREATE TABLE SubjectMapping (

    OriginalSubject VARCHAR(50),

    MappedSubject VARCHAR(50),

    Weight DECIMAL(5, 2)

);


INSERT INTO SubjectMapping (OriginalSubject, MappedSubject, Weight) VALUES

('Biology', 'Science', 0.33),

('Chemistry', 'Science', 0.33),

('Physics', 'Science', 0.34),

('Geography', 'Social', 0.5),

('History', 'Social', 0.5);



SELECT * FROM Grades

SELECT * FROM SubjectMapping

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