-
Notifications
You must be signed in to change notification settings - Fork 17
/
SQL.textexpander
99 lines (99 loc) · 3.24 KB
/
SQL.textexpander
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>groupInfo</key>
<dict>
<key>expandAfterMode</key>
<integer>0</integer>
<key>groupName</key>
<string>SQL</string>
</dict>
<key>snippetsTE2</key>
<array>
<dict>
<key>abbreviation</key>
<string>db:new</string>
<key>abbreviationMode</key>
<integer>1</integer>
<key>creationDate</key>
<date>2013-06-23T05:50:09Z</date>
<key>label</key>
<string>Create new database</string>
<key>modificationDate</key>
<date>2013-06-23T05:50:09Z</date>
<key>plainText</key>
<string>CREATE DATABASE %filltext:name=Database%;</string>
<key>snippetType</key>
<integer>0</integer>
<key>uuidString</key>
<string>70449749-01C2-45BE-8B12-D77F1FB46C5C</string>
</dict>
<dict>
<key>abbreviation</key>
<string>db:del</string>
<key>abbreviationMode</key>
<integer>1</integer>
<key>creationDate</key>
<date>2013-06-23T05:48:37Z</date>
<key>label</key>
<string>Delete database</string>
<key>modificationDate</key>
<date>2013-06-23T05:50:43Z</date>
<key>plainText</key>
<string>DROP DATABASE %filltext:name=Database%;</string>
<key>snippetType</key>
<integer>0</integer>
<key>uuidString</key>
<string>00B87955-E1B0-4C5F-A152-16D179248021</string>
</dict>
<dict>
<key>abbreviation</key>
<string>db:size</string>
<key>abbreviationMode</key>
<integer>0</integer>
<key>creationDate</key>
<date>2015-08-06T18:46:02Z</date>
<key>label</key>
<string>Get size of all database tables (largest first)</string>
<key>modificationDate</key>
<date>2015-08-06T18:47:02Z</date>
<key>plainText</key>
<string>SELECT table_name AS "Tables",
round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB"
FROM information_schema.TABLES
WHERE table_schema = "%filltext:name=Database name%"
ORDER BY (data_length + index_length) DESC;</string>
<key>snippetType</key>
<integer>0</integer>
<key>uuidString</key>
<string>761650F8-1417-4219-9EDF-4FD233405EBF</string>
</dict>
<dict>
<key>abbreviation</key>
<string>db:report</string>
<key>abbreviationMode</key>
<integer>0</integer>
<key>creationDate</key>
<date>2015-08-06T18:47:38Z</date>
<key>label</key>
<string>Get size and stats of all datatabases</string>
<key>modificationDate</key>
<date>2015-08-06T18:48:42Z</date>
<key>plainText</key>
<string>SELECT CONCAT(table_schema, '.', table_name) AS "DB/Table name",
CONCAT(ROUND(table_rows / 1000000, 2), 'M') rows,
CONCAT(ROUND(data_length / ( 1024 * 1024 * 1024 ), 2), 'G') DATA,
CONCAT(ROUND(index_length / ( 1024 * 1024 * 1024 ), 2), 'G') idx,
CONCAT(ROUND(( data_length + index_length ) / ( 1024 * 1024 * 1024 ), 2), 'G') total_size,
ROUND(index_length / data_length, 2) idxfrac
FROM information_schema.TABLES
ORDER BY data_length + index_length DESC;</string>
<key>snippetType</key>
<integer>0</integer>
<key>uuidString</key>
<string>ACB68A56-C325-478D-BA36-A50F59B8438F</string>
</dict>
</array>
</dict>
</plist>