Search value in Multiple columns

 DML Script:


DROP TABLE IF EXISTS Subjects;


CREATE TABLE Subjects (

    name VARCHAR(100),

    age INT,

    Subject1 VARCHAR(100),

    Subject2 VARCHAR(100),

    Subject3 VARCHAR(100),

    Subject4 VARCHAR(100),

    Subject5 VARCHAR(100)

);


INSERT INTO Subjects (name, age, Subject1, Subject2, Subject3, Subject4, Subject5)

VALUES 

('John Doe', 25, 'Mathematics', 'Physics', 'Chemistry', 'Biology', 'English'),

('Jane Smith', 22, 'History', 'Chemistry', 'Political Science', 'Physics', 'Mathematics'),

('Alice Johnson', 30, 'Chemistry', 'Sociology', 'Anthropology', 'Mathematics', 'Literature'),

('Bob Brown', 28, 'Computer Science', 'Chemistry', 'Artificial Intelligence', 'Machine Learning', 'Mathematics'),

('Charlie Black', 35, 'Law', 'Mathematics', 'Forensic Science', 'Public Administration', 'Chemistry');


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