private Table createViewLikeTable(Table oldTable) throws HiveException {
    Table table = context.getDb().newTable(desc.getTableName());

    if (desc.getTblProps() != null) {
      table.getTTable().getParameters().putAll(desc.getTblProps());
    }

    table.setTableType(TableType.MANAGED_TABLE);

    if (desc.isExternal()) {
      setExternalProperties(table);
    }

    setUserSpecifiedLocation(table);

    table.setFields(oldTable.getCols());
    table.setPartCols(oldTable.getPartCols());

    if (desc.getDefaultSerdeProps() != null) {
      for (Map.Entry<String, String> e : desc.getDefaultSerdeProps().entrySet()) {
        table.setSerdeParam(e.getKey(), e.getValue());
      }
    }

    setStorage(table);

    return table;
  }
Operation process of creating a table like an existing one.
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/create/like/CreateTableLikeOperation.java