mysql -h irtfweb -u cshell -p
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2009449
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| cshell |
| test |
| test_dewar |
+--------------------+
4 rows in set (0.01 sec)
mysql> use cshell;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+------------------+
| Tables_in_cshell |
+------------------+
| Data |
| Sensors |
+------------------+
2 rows in set (0.00 sec)
mysql> SELECT * FROM Sensors;
+-----------+-----------------------------------+
| SensorID | Notes |
+-----------+-----------------------------------+
| tca_t1 | TcA temperature 1, kelvin |
| tca_t2 | TcA temperature 2, kelvin |
| tca_setpt | TcA set point, kelvin |
| tca_heat | TcA heater output, 0-100, percent |
| tca_p | TcA P value |
| tca_i | TcA I value |
| tca_d | TcA D value |
| tcb_t1 | TcB temperature 1, kelvin |
| tcb_t2 | TcB temperature 2, kelvin |
| tcb_setpt | TcB set point, kelvin |
| tcb_heat | TcB heater output, 0-100, percent |
| tcb_p | TcB P value |
| tcb_i | TcB I value |
| tcb_d | TcB D value |
+-----------+-----------------------------------+
14 rows in set (0.00 sec)
(Here is a complex example, we will query for the tca_ data, from a specific time, the data
is grouped and order by timestamp.)
mysql> SELECT Timestamp, FROM_UNIXTIME(Timestamp) AS Date, GROUP_CONCAT(SensorData ORDER BY SensorID SEPARATOR ' ') AS SensorData
FROM Data
WHERE (Timestamp > UNIX_TIMESTAMP('2014-11-21 10:30:00')) AND (Timestamp < UNIX_TIMESTAMP('2014-11-21 12:30:00'))
AND SensorID LIKE 'tca_%'
GROUP by Timestamp;
+------------+---------------------+-------------------------+
| Timestamp | Date | SensorData |
+------------+---------------------+-------------------------+
| 1416603924 | 2014-11-21 11:05:24 | 101 21 151 501 30 30 59 |
| 1416603945 | 2014-11-21 11:05:45 | 101 20 151 501 30 30 60 |
| 1416604003 | 2014-11-21 11:06:43 | 101 20 151 501 30 29 61 |
| 1416604061 | 2014-11-21 11:07:41 | 101 19 151 501 30 30 60 |
| 1416604119 | 2014-11-21 11:08:39 | 101 19 151 501 30 30 58 |
| 1416604178 | 2014-11-21 11:09:38 | 101 19 151 501 30 29 60 |
| 1416604236 | 2014-11-21 11:10:36 | 101 20 151 501 30 29 58 |
+------------+---------------------+-------------------------+
mysql> exit