Difference between revisions of "MySQL"

From Vrieze Wiki
Jump to navigation Jump to search
Line 14: Line 14:
 
  select * from user_location where user_id='6346669087044735461' order by sample_time desc limit 10;
 
  select * from user_location where user_id='6346669087044735461' order by sample_time desc limit 10;
 
  </syntaxhighlight>
 
  </syntaxhighlight>
 +
 +
Python script to extract entries from a table and write to tab-delimited file
 +
<syntaxhighlight lang="python">
 +
TBD
 +
</sintaxhighlight>

Revision as of 19:54, 4 December 2015

MySQL

Connecting to MySQL server in bash

 # Connect to mysql server
 mysql --host=<ip.address> --user=<username> --password=<password>

MySQL commands

 show databases;      # show the databases
 use userdata_schema; # connect to a particular database
 show tables;         # list the tables within the database
 select * from table_name limit 10; # to see what's in a table (first ten entries)
 select * from user_location where user_id='6346669087044735461' order by sample_time desc limit 10;

Python script to extract entries from a table and write to tab-delimited file

<syntaxhighlight lang="python">
TBD
</sintaxhighlight>