Search code examples
mysqlcreate-tabledatagrip

How can I generate a CREATE TABLE statement from a SELECT statement in Datagrip?


Is there a way to generate a CREATE TABLE statement from a SELECT statement (that is built from many JOINs)?

I can only find it for tables and views. But my problem is that I am using Google Cloud SQL (mysql version) and I cannot change the settings to use the CREATE TABLE ... SELECT * ....

Is there a way to do it handy in DataGrip?


Solution

  • Do the following:

    1. You need to execute the query and get results
    2. Then in result set select "Export data..." and select "SQL Inserts"
    3. Check "Add table definition(DDL)"

    create table

    Detailed feature request and description are mentioned in the issue DBE-8596