This is a quick reference article, to save time looking. Every so often I need to port tables between systems, either different versions, hosts or platforms. Automated tools are faster if one does this routinely; but for singular use, the following allows best control (and lets you adjust the indices etc).

The SQL variables should be replaced with their logical values...

Oracle


set pages 0
set long 999999
select dbms_metadata.get_ddl('TABLE', '@db', '@table') from dual;

The Oracle suite ships with a lot of tools, one may also use

 exp userid=system file=full_ddl.dmp rows=n

MySQL


use @db
show create table @table

postgres