MySQL | Cartesian Product
Cartesian Product:\nThe Activity table is called twice (cross-join), once as the table that stores the start timestamps and once as the table that stores the en
## **Cartesian Product:**\nThe `Activity` table is called twice (cross-join), once as the table that stores the `start timestamps` and once as the table that stores the `end timestamps` and find out the average time each machine takes to complete a process.\n\n# Code\n```mysql []\n# Write your MySQL query statement below\nselect a.machine_id, round(avg(b.timestamp - a.timestamp), 3) as processing_time from activity a, activity b where a.machine_id = b.machine_id and a.process_id = b.process_id and \na.activity_type = \'start\' and b.activity_type = \'end\'\ngroup by machine_id;\n\n```
['Database', 'MySQL']