mysql -h<host name> -u<username> -p<password> <database name> < my-dump.file
How to dump the contents of 1 table from MySQL into a file, that includes SQL type INSERT statements
mysqldump -h<host name> -u<username> -p<password> <db name> <table name> > my-dump.file TIP: When dumping tables or databases, it’s worth adding –quote-names as a parameter, just in case you may have used a reserved word as a table or column name.
How to dump the entire contents of a database from MySQL into a file, that includes SQL type INSERT statements
mysqldump -h <host name> -u<username> -p<password> <db name> > my-dump.file
How do I extract the 1st position of a character string that are numbers and then order by number using MySQL
This can be accomplished using one select statement. It involves using the REPLACE, LEFT and CAST functions. Say we have this string: 1. This is no. 1 9. This is no. 9 10. This is no. 10 If you use
How do I get the last occurence of a character from a string using MySQL
This is a tricky one, but the best way to go about it is to first reverse the string then find the first occurence of the string. Then subtract the length of the string from the location of the string
How do I get the latest date and time in an SQL query
The best way of doing this is to use the command now() in your sql statement for both date and time, e.g.: INSERT INTO MYTABLE (MYDATE, DESCRIPTION) VALUES (now(), description); If you just want the date only then use CURDATE()
How do I get a list of my MySQL tables?
Write a SELECT that includes the following text: SHOW TABLES FROM <databaseName>; This will present you with a list of the MySQL data dictionary type tables in your database, you can then also add a ‘WHERE’ or ‘LIKE’ command to