I'm going to add a little more detail here.
There's a total of four kinds of note and attachment object you might be seeing on your objects, and they're queried in different ways.
SELECT Id FROM Attachment WHERE ParentId = 'SOME_ID'
SELECT Id FROM Attachment WHERE Parent.Type = 'SOME_SOBJECT_TYPE'
will get you data on your old-style Attachments.
These work just like Attachments, but with a different sObject:
SELECT Id FROM Note WHERE ParentId = 'SOME_ID'
SELECT Id FROM Note WHERE Parent.Type = 'SOME_SOBJECT_TYPE'
Content Notes and Content Documents
Content Notes are the new-style "Enhanced Notes". They're built on the Content architecture under the hood, and have rich-text bodies.
Content Documents (with associated Content Versions) represent the new Lightning Files.
Unfortunately, both are related to records using the
ContentDocumentLink object, rather than having a direct lookup, and this comes with some significant query limitations:
You can't run a query without filters against ContentDocumentLink.
You can't filter on ContentDocument fields if you're filtering by ContentDocumentId. You can only filter on ContentDocument fields if you're filtering by LinkedEntityId.
You can't filter on the related object fields. For example, you can't filter on the properties of the account to which a file is linked. You can filter on the properties of the file, such as the title field.
A SOQL query must filter on one of Id, ContentDocumentId, or LinkedEntityId.
So, to be short, you can't query all
ContentDocument records attached to some specific type of object easily.
You'd have to do something like exporting all Ids for a given sObject type and iteratively querying sets of those Ids against the
ContentDocumentLink table to locate attached files. This is something I've done before (and written about here), but it takes some Python or another scripting language to get it done.
If you do have a specific Id or Ids of records whose attachments you want to find, you can do it like this:
SELECT ContentDocumentId, ContentDocument.Title FROM ContentDocumentLink WHERE LinkedEntityId = 'OBJECT_ID'
Note that Content Notes are returned in a Content Document query - they are just a special type of Document.