CREATE TABLE tableName
(
abcd VARCHAR(512),
1.2.3.4 VARCHAR(512),
120 VARCHAR(512),
2024-02-27 09:59:03 VARCHAR(512),
VARCHAR(512),
VARCHAR(512),
VARCHAR(512),
VARCHAR(512),
VARCHAR(512),
VARCHAR(512)
);
INSERT INTO tableName (abcd, 1.2.3.4, 120, 2024-02-27 09:59:03, , , , , , ) VALUES ('abcd', '1.2.3.4', '120', '2024-02-27 09:59:00', '', '', '', '', '', '');
INSERT INTO tableName (abcd, 1.2.3.4, 120, 2024-02-27 09:59:03, , , , , , ) VALUES ('efgh', '9.10.11.12', '120', '2024-02-27 09:30:00', '', '', '', '', '', '');
INSERT INTO tableName (abcd, 1.2.3.4, 120, 2024-02-27 09:59:03, , , , , , ) VALUES ('efgh', '9.10.11.12', '120', '2024-02-26 09:00:00', '', '', '', '', '', '');
INSERT INTO tableName (abcd, 1.2.3.4, 120, 2024-02-27 09:59:03, , , , , , ) VALUES ('random', '1ANDOM', 'random', 'random', '', '', '', '', '', '');
INSERT INTO tableName (abcd, 1.2.3.4, 120, 2024-02-27 09:59:03, , , , , , ) VALUES ('random', 'random', 'random', 'random', '', '', '', '', '', '');
INSERT INTO tableName (abcd, 1.2.3.4, 120, 2024-02-27 09:59:03, , , , , , ) VALUES ('', '', '', '', '', '', '', '', '', '');
INSERT INTO tableName (abcd, 1.2.3.4, 120, 2024-02-27 09:59:03, , , , , , ) VALUES ('', '', '', '', '', '', '', '', '', '');
INSERT INTO tableName (abcd, 1.2.3.4, 120, 2024-02-27 09:59:03, , , , , , ) VALUES ('', '', '', '', '', '', '', '', '', '');
INSERT INTO tableName (abcd, 1.2.3.4, 120, 2024-02-27 09:59:03, , , , , , ) VALUES ('', '', '', '', '', '', '', '', '', '');
This is the table. What I want is this.
Find only the rows whose A's are same AND B's are same, C=120 and D's difference is less than 3 seconds.
How'd I do it?
Rather than crude answers, I'd love some guidance (teach a man to fish rather than giving him a fish)
I am trying to learn SQL advanced concepts by these practical scenarios in my job where I get less opportunity to use SQL as I am not a data analyst but a support engineer. Any guidance to practice SQL in scenarios like this is also appreciated.