Most SQL questions do not need a local database, they need a minimal example. DB Fiddle splits the schema (tables and sample data) from the query, runs it on the engine and version you pick, and gives you one link with everything together.
The best habit is matching the production version. JSON behavior, CTEs, window functions and even sort order differ between PostgreSQL and MySQL, and between versions of the same database. Testing on the wrong engine answers the wrong question. It is also the best way to ask for help: a link with a schema and query that reproduce the problem beats a paragraph of explanation.
The caution comes from the sharing itself. A saved fiddle becomes a link, so build the example with made-up data, never a production dump or customer data. And do not use it to measure performance: with half a dozen rows, the plan and timing say nothing about the real table.