

Here based on the output of the inner query. SELECT SERIAL_NO FROM TEST_NOT_EQUAL WHERE LOCATION 'USA' The output of the inner query is as below, which will get the data from the table where location is not equal to ‘USA’. WHERE SERIAL_NO IN ( SELECT SERIAL_NO FROM TEST_NOT_EQUAL WHERE We can perform the Sub query for the same table and apply the ‘not equal’. You could see that the output has filtered the ‘USA’ data and returned the rest of the data in the above out. SELECT * FROM TEST_NOT_EQUAL WHERE LOCATION 'USA' Now let us get the data from the table where Location is not equal to ‘USA’. Now let us see the data from the table: – INSERT INTO TEST_NOT_EQUAL VALUES (6, 'Rodger', 'Norway', 24, 'Software Engineer', '7893412564' ) INSERT INTO TEST_NOT_EQUAL VALUES (3, 'Will', 'Denmark', 24, 'Software Engineer', '7656789843' ) Now let us consider another table as below and find the working of ‘Not Equal’. Where id NOT IN( select id from job_status where status != 'yes') Which means we get the output as for id = 1, 2, 5, 6. This output will be passed to the outer query, and the outer query gets the id row data not equal to 3,4. Here the output from the inner query is 3,4. Select id from job_status where status != 'yes' Here let us see the output of the inner query first. Where id not in( select id from job_status where status != 'yes') SELECT * FROM NOT_EQUAL_DEMO WHERE AMOUNT != 35000 īoth the symbols act similar and get the data from the table. Here in the above query, we filter the data and extract all rows that are not equal to 35000. SELECT * FROM NOT_EQUAL_DEMO WHERE AMOUNT 35000 But, first, let us get the data from the table where the amount is not equal to 35000.

Now let us filter the data from the above table. Now let us select data from the above table: – Insert into job_status values ( 6, 'yes') Insert into job_status values ( 5, 'yes') Insert into job_status values ( 4, 'no') Insert into job_status values ( 3, 'no')

Insert into job_status values ( 2, 'yes') Insert into job_status values ( 1, 'yes') Let us select the data from the above table: –

Insert into Not_equal_demo values ( 6, 'Robert', 35000 ) Insert into Not_equal_demo values ( 5, 'Pinky', 35000 ) Insert into Not_equal_demo values ( 4, 'Henry', 56000 ) Insert into Not_equal_demo values ( 3, 'Will', 79000 ) Insert into Not_equal_demo values ( 2, 'Sam', 89000 ) Insert into Not_equal_demo values ( 1, 'Rose', 90000 ) Insert the below rows into the above table: – Now let us create a table, apply the ‘not equal’ operator, and check how it works. != ‘value’ How does MySQL Not Equal works? Hadoop, Data Science, Statistics & othersīelow is the syntax for the ‘Not equal’ operator.
