- bouchet's home page
- Posts
- 2016
- 2015
- December (1)
- November (3)
- October (2)
- September (2)
- August (2)
- June (2)
- April (5)
- March (2)
- February (3)
- January (2)
- 2014
- December (2)
- November (2)
- October (3)
- September (2)
- August (3)
- July (1)
- June (3)
- May (6)
- April (6)
- March (1)
- February (2)
- January (1)
- 2013
- December (2)
- November (3)
- October (3)
- September (4)
- August (1)
- July (1)
- May (4)
- April (6)
- March (4)
- February (3)
- 2012
- 2011
- December (2)
- November (2)
- October (4)
- September (1)
- August (2)
- July (6)
- June (2)
- May (3)
- April (3)
- March (2)
- 2010
- 2009
- December (2)
- November (1)
- October (3)
- September (1)
- August (1)
- July (1)
- June (2)
- April (1)
- March (2)
- February (2)
- January (1)
- 2008
- My blog
- Post new blog entry
- All blogs
DB online command
- to connect to MySqL :
#! /bin/tcsh -f mysql -h dbx.star.bnl.gov --port=3316 -u "" -p"" StarDb
2. to see the whole db :
show databases;
which gives :
+----------------------+
| Database |
+----------------------+
| information_schema |
| Calibrations |
| Calibrations_eemc |
| Calibrations_emc |
| Calibrations_fms |
| Calibrations_ftpc |
| Calibrations_l2 |
| Calibrations_l3 |
| Calibrations_pmd |
| Calibrations_pp2pp |
| Calibrations_rhic |
| Calibrations_rich |
| Calibrations_ssd |
| Calibrations_svt |
| Calibrations_tof |
| Calibrations_tpc |
| Calibrations_tracker |
| Calibrations_trg |
| Calibrations_zdc |
| Conditions |
| Conditions_trg |
| Geometry |
| Geometry_eemc |
| Geometry_emc |
| Geometry_fms |
| Geometry_ftpc |
| Geometry_pmd |
| Geometry_pp2pp |
| Geometry_ssd |
| Geometry_svt |
| Geometry_tof |
| Geometry_tpc |
| RunLog |
| RunLog_l3 |
| RunLog_onl |
| RunLog_rhic |
| StarDb |
| test |
+----------------------+
38 rows in set (0.00 sec)
3. To select a specific table :
use Calibrations_ssd;
then
show tables;
which gives :
+----------------------------+
| Tables_in_Calibrations_ssd |
+----------------------------+
| GainIDs |
| NodeRelation |
| Nodes |
| StripIDs |
| schema |
| ssdGainCalibWafer |
| ssdNoise |
| ssdStripCalib |
| ssdWaferConfiguration |
| structure |
+----------------------------+
10 rows in set (0.00 sec)
4. to see the details of a given table
explain ssdStripCalib;
which gives :
+-----------+---------------------+------+-----+---------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+---------------------+------+-----+---------------------+----------------+
| dataID | int(11) | NO | MUL | NULL | auto_increment |
| entryTime | timestamp | NO | MUL | CURRENT_TIMESTAMP | |
| nodeID | int(11) | NO | PRI | 0 | |
| elementID | mediumint(9) | NO | PRI | 0 | |
| beginTime | datetime | NO | PRI | 1970-01-01 00:00:00 | |
| endTime | datetime | NO | | 2037-01-01 00:00:00 | |
| flavor | char(32) | NO | PRI | ofl | |
| schemaID | int(11) | NO | | 1 | |
| deactive | int(10) unsigned | NO | PRI | 0 | |
| id | int(11) | YES | | NULL | |
| pedestals | tinyint(3) unsigned | YES | | NULL | |
| rms | tinyint(3) unsigned | YES | | NULL | |
+-----------+---------------------+------+-----+---------------------+----------------+
12 rows in set (0.00 sec)
5. to have the value of a given entry with some conditon :
mysql> select entryTime,beginTime,flavor,id,pedestals,rms from ssdStripCalib where id=907912;
6. condition based on entryTime/beginTime
select id from pxlLadderOnSector where entryTime>"2013-04-15 00:00:00";
- bouchet's blog
- Login or register to post comments