MySQL|Beats 95.15%|Easy understand|NOT JOIN
My idea is to select the name in SalesPerson table from another table which shows the sales_id doesn\'t have any "RED" company\'s order and the company\'s ids, 
My idea is to select the ```name``` in ```SalesPerson``` table from another table which shows the ```sales_id``` doesn\'t have any ```"RED"``` company\'s order and the company\'s ids, ```com_id```, both in orders and company are the same.\n\nHere is my code:\nThis version was faster than 95.15% of MySQL online submissions for Sales Person.\nRuntime: **983 ms**\n```\nSELECT s.name FROM `SalesPerson` AS s\nWHERE s.sales_id NOT IN (\n    SELECT o.sales_id\n    FROM `orders` AS o, `company` AS c\n    WHERE o.com_id=c.com_id AND c.name="RED"\n)\n```\n\nI also submitted another slow vision before.\nRuntime: **1532 ms**\n```\nSELECT s.name FROM `SalesPerson` AS s\nWHERE s.sales_id NOT IN (\n    SELECT o.sales_id FROM `orders` AS o\n    WHERE o.com_id IN (\n    SELECT c.com_id FROM `company` AS c\n        WHERE c.name="RED"\n    )\n)\n```\nAnd I found something interesting that if I deletes ```AS``` which is used to tell a computer I want to call the table another shorter name, it would cost more time to run. About 450ms.\n\n\nIf it\'s helpful to you, please upvote. Thanks:)
['MySQL']