-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
148 lines (137 loc) · 6.7 KB
/
Copy pathindex.html
File metadata and controls
148 lines (137 loc) · 6.7 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MySQL Query Builder</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<!-- Header -->
<div class="header">
<div class="header-content">
<svg class="database-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<ellipse cx="12" cy="5" rx="9" ry="3"></ellipse>
<path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"></path>
<path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"></path>
</svg>
<h1>MySQL Query Builder</h1>
</div>
<p class="subtitle">Visual database design & SQL code generation</p>
</div>
<!-- Main Container -->
<div class="main-container">
<!-- Step 1: Database & Table Names -->
<div id="step1" class="step-section">
<div class="step-header">
<div class="step-number">1</div>
<h2>Database & Table</h2>
</div>
<div class="grid-2">
<div>
<label>Database Name</label>
<input type="text" id="dbName" placeholder="e.g., my_database">
</div>
<div>
<label>Table Name</label>
<input type="text" id="tableName" placeholder="e.g., users">
</div>
</div>
</div>
<!-- Step 2: Number of Columns -->
<div id="step2" class="step-section">
<div class="step-header">
<div class="step-number">2</div>
<h2>Define Columns</h2>
</div>
<div class="flex-row">
<div class="flex-1">
<input type="number" id="numColumns" placeholder="Number of columns" min="1">
<div id="numColumnsError" class="error-message"></div>
</div>
<button id="createColumnsBtn" class="btn btn-primary" disabled>
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
<line x1="3" y1="9" x2="21" y2="9"></line>
<line x1="9" y1="21" x2="9" y2="9"></line>
</svg>
Create
</button>
</div>
</div>
<!-- Step 2b: Column Names -->
<div id="columnNamesSection" class="step-section" style="display: none;">
<div class="sub-section">
<h3>Enter Column Names</h3>
<p class="hint">Must start with letter/underscore, contain only letters, numbers, underscores</p>
<div id="columnInputsContainer" class="grid-2"></div>
</div>
<button id="confirmColumnsBtn" class="btn btn-success full-width">
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="20 6 9 17 4 12"></polyline>
</svg>
Confirm Columns
</button>
</div>
<!-- Step 3: Insert Rows -->
<div id="step3" class="step-section" style="display: none;">
<div class="step-header">
<div class="step-number">3</div>
<h2>Insert Data Rows</h2>
</div>
<!-- Existing Rows -->
<div id="existingRowsSection" class="sub-section" style="display: none;">
<h3>Added Rows (<span id="rowCount">0</span>)</h3>
<div id="existingRowsList" class="rows-list"></div>
</div>
<!-- Current Row Inputs -->
<div class="sub-section">
<h3>New Row</h3>
<div id="currentRowInputs" class="grid-2"></div>
<div id="rowError" class="error-message"></div>
</div>
<div class="flex-row gap-3">
<button id="addRowBtn" class="btn btn-primary flex-1">
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="12" y1="5" x2="12" y2="19"></line>
<line x1="5" y1="12" x2="19" y2="12"></line>
</svg>
Add Row
</button>
<button id="generateSQLBtn" class="btn btn-success flex-1" disabled>
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="16 18 22 12 16 6"></polyline>
<polyline points="8 6 2 12 8 18"></polyline>
</svg>
Generate SQL
</button>
</div>
</div>
<!-- Step 4: Generated SQL -->
<div id="step4" class="step-section" style="display: none;">
<div class="step-header">
<div class="step-number success">✓</div>
<h2>Generated SQL</h2>
</div>
<div class="sql-output">
<pre id="sqlOutput"></pre>
<button id="copyBtn" class="btn-copy">
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
</svg>
<span id="copyBtnText">Copy</span>
</button>
</div>
<button id="resetBtn" class="btn btn-secondary full-width">Start Over</button>
</div>
</div>
<!-- Footer -->
<div class="footer">
© <script>document.write(new Date().getFullYear())</script> • Mohammed Siddiq • Ramaiah Polytechnic
</div>
</div>
<script src="script.js"></script>
</body>
</html>