SQL design for hierarchical structure where parent unit should not exist without subunits I'm new to SQL so I wasn't sure what to even search for this besides looking at hierarchical structures which don't seem to be exactly my use case. 

I'm building an app where a Post contains multiple Pages, each containing multiple Videos and Images. I currently have a table for a Post, a Page, a Video, and an Image where a Page contains a reference to its post id and a Video or Image each contain a reference to their page id. I thought this would work, but I need to insert the Post object in order to get its id to store in each Page object, but a Post object should not exist without pages. And yet a Page should not exist without belonging to a Post object. So I'm not sure how to structure these tables.
Are you saying that you have troubles with FOREIGN KEYs.  If so, don' t use them.

If you are saying that a POST exists briefly without any PAGEs, then put the generation of both the POST and the PAGEs inside a transaction (BEGIN...COMMIT).