I have a very large MySQL database and I need to know how many foreign keys does it have. I tried with the command:

```
SELECT COUNT(*) AS 'number of foreign keys'
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
WHERE TABLE_SCHEMA='pubs' 
AND REFERENCED_TABLE_NAME IS NOT NULL;

```

in a small database (pubs) and it returned the correct number of foreign keys, but I'm not sure if this query is OK in all cases.
Is this query correct? Is there another way?

Thanks in advance.