WHAT'S NEW?
Loading...
Showing posts with label MySQL Commands. Show all posts
Showing posts with label MySQL Commands. Show all posts
A query to obtain phone number of users from users table through regular expression matching:
SELECT phone_number FROM users WHERE phone_number REGEXP '^[0-9]{10}$'
The above is a query to match 10 digit number. 0 is allowed as first digit of number, this is quite not useful in case of mobile number. The regular expression can be modified as '^98[0-9]{8}$' for mobile numbers like 9800456745
Creating log of MySQL Command-line Sessions, Creating log in MySQL, Logging your MySQL Command-line sessions, MySQL tee Command Example, MySQL notee Command Example, MySQL tee Saving our output to a file


Sometimes we may require to review our commands that are executed in MySQL. So, if we have a log of our commands, it may be helpful to see what changes we have made. There's an important MySQL command that enables the log of commands executed in MySQL.

The command is as:
tee path_of_file_for_storing_logs
e.g   tee C:\logs\log1.txt

Now each command executed is tracked and the log of them is maintained in the log file.
There may be a need to end the logging process. This is done by a command called:

notee 
This is very useful command if we need to revert some changes we have made. Database administrators require this to administer every changes made to the database. If there are some errors, they can be traced easily.