There is currently no way to export your database and/or tables into an sql file through a query command. You will need to make use of the mysqldump command-line function.
Simple export:
mysqldump db_name tbl_name > backup-file.sql;
Note that without giving any destination path, your file will be located in the same directory where you performed the dump.
Export to specified path:
mysqldump db_name tbl_name > C:\"backup"\backup-file.sql;
Simple import:
mysql> use db_name;
mysql> source backup-file.sql;
Import from specified path:
mysql> use db_name;
mysql> source C:\"backup"\backup-file.sql;
Using double-quotes "
around your path is only necessary in case you make use of white spaces in your directory path.