Repository navigation
Expand file tree
/
Copy pathmysql.html
More file actions
256 lines (240 loc) · 7.77 KB
/
Copy pathmysql.html
File metadata and controls
256 lines (240 loc) · 7.77 KB
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>MySQL Commands Reference</title>
<!-- <link rel="stylesheet" href="style.css" /> -->
<style>
body {
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(to right, #e0f7fa, #e1bee7);
margin: 0;
padding: 20px;
}
.container {
max-width: 1100px;
margin: 0 auto;
padding: 20px;
}
h1 {
text-align: center;
color: #333;
margin-bottom: 20px;
font-size: 2.5rem;
}
input[type="text"] {
width: 100%;
padding: 15px;
font-size: 1rem;
margin-bottom: 30px;
border: 2px solid #90caf9;
border-radius: 8px;
box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
}
.grid {
display: grid;
gap: 20px;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.card {
background: white;
padding: 20px;
border-left: 4px solid #42a5f5;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
transition: transform 0.2s ease;
}
.card:hover {
transform: translateY(-5px);
}
.card h2 {
margin-top: 0;
color: #1e88e5;
}
.card p {
color: #555;
font-size: 0.9rem;
}
</style>
</head>
<body>
<div class="container">
<h1>MySQL Commands Reference</h1>
<input type="text" id="searchInput" placeholder="Search MySQL command..." onkeyup="filterCommands()" />
<div id="commandList" class="grid"></div>
</div>
<script>
const commands = [
{ command: "CREATE DATABASE", description: "Creates a new database." },
{ command: "DROP DATABASE", description: "Deletes an existing database." },
{
command: "CREATE TABLE",
description: "Creates a new table within the selected database.",
},
{
command: "DROP TABLE",
description: "Deletes a table and all of its data.",
},
{
command: "ALTER TABLE",
description: "Modifies an existing table structure.",
},
{ command: "RENAME TABLE", description: "Renames a table." },
{
command: "TRUNCATE TABLE",
description:
"Removes all rows from a table without logging individual row deletions.",
},
{ command: "INSERT", description: "Adds new data into a table." },
{ command: "REPLACE", description: "Inserts or updates a row in a table." },
{ command: "UPDATE", description: "Modifies existing data within a table." },
{
command: "DELETE",
description: "Deletes rows from a table based on a condition.",
},
{ command: "SELECT", description: "Retrieves data from one or more tables." },
{
command: "WHERE",
description: "Filters records based on a specific condition.",
},
{
command: "GROUP BY",
description: "Groups rows that have the same values in specified columns.",
},
{
command: "HAVING",
description: "Filters groups based on a condition (used with GROUP BY).",
},
{
command: "ORDER BY",
description: "Sorts the result set by one or more columns.",
},
{
command: "LIMIT",
description: "Restricts the number of records returned.",
},
{
command: "OFFSET",
description: "Specifies the starting point within the result set.",
},
{ command: "JOIN", description: "Combines rows from two or more tables." },
{
command: "INNER JOIN",
description: "Returns rows when there is a match in both tables.",
},
{
command: "LEFT JOIN",
description:
"Returns all rows from the left table, and matched rows from the right table.",
},
{
command: "RIGHT JOIN",
description:
"Returns all rows from the right table, and matched rows from the left table.",
},
{
command: "FULL JOIN",
description: "Returns rows when there is a match in one of the tables.",
},
{
command: "CROSS JOIN",
description: "Returns the Cartesian product of rows from joined tables.",
},
{
command: "UNION",
description: "Combines the result-set of two or more SELECT statements.",
},
{
command: "UNION ALL",
description: "Combines result sets but does not remove duplicates.",
},
{
command: "DISTINCT",
description: "Removes duplicate records from the result set.",
},
{
command: "LIKE",
description: "Searches for a specified pattern in a column.",
},
{
command: "IN",
description:
"Checks whether a value matches any value in a list or subquery.",
},
{ command: "BETWEEN", description: "Selects values within a given range." },
{ command: "IS NULL", description: "Tests for empty (NULL) values." },
{
command: "IS NOT NULL",
description: "Tests for non-empty (NOT NULL) values.",
},
{ command: "SHOW DATABASES", description: "Lists all available databases." },
{
command: "SHOW TABLES",
description: "Lists all tables in the selected database.",
},
{ command: "SHOW COLUMNS", description: "Shows column details of a table." },
{ command: "DESCRIBE", description: "Gives the structure of a table." },
{
command: "USE",
description: "Selects a specific database to run queries on.",
},
{
command: "SET",
description: "Changes system variables or user-defined variables.",
},
{
command: "SHOW VARIABLES",
description: "Displays system variable values.",
},
{ command: "SHOW STATUS", description: "Shows server status information." },
{ command: "FLUSH", description: "Clears or reloads internal caches." },
{
command: "GRANT",
description: "Gives user access privileges to databases/tables.",
},
{ command: "REVOKE", description: "Removes user access privileges." },
{ command: "CREATE USER", description: "Creates a new MySQL user." },
{ command: "DROP USER", description: "Deletes an existing MySQL user." },
{
command: "SET PASSWORD",
description: "Changes the password for a user account.",
},
{ command: "EXPLAIN", description: "Analyzes a SQL query execution plan." },
{ command: "START TRANSACTION", description: "Begins a new transaction." },
{ command: "COMMIT", description: "Commits the current transaction." },
{ command: "ROLLBACK", description: "Rolls back the current transaction." },
{
command: "SAVEPOINT",
description: "Sets a savepoint within a transaction.",
},
{ command: "RELEASE SAVEPOINT", description: "Removes a savepoint." },
{
command: "SHOW GRANTS",
description: "Displays privileges granted to a MySQL user.",
},
];
const listContainer = document.getElementById("commandList");
function displayCommands(data) {
listContainer.innerHTML = "";
data.forEach((item) => {
const card = document.createElement("div");
card.className = "card";
card.innerHTML = `
<h2>${item.command}</h2>
<p>${item.description}</p>
`;
listContainer.appendChild(card);
});
}
function filterCommands() {
const input = document.getElementById("searchInput").value.toLowerCase();
const filtered = commands.filter((cmd) =>
cmd.command.toLowerCase().includes(input),
);
displayCommands(filtered);
}
displayCommands(commands); // Initial render
</script>
</body>
</html>