-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbr2sql.html
More file actions
385 lines (326 loc) · 27.6 KB
/
br2sql.html
File metadata and controls
385 lines (326 loc) · 27.6 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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-W3TJ27QQ4T"></script>
<script src="/products/ecommerce.js"></script>
<script>
// [start] GA Tag
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'G-W3TJ27QQ4T');
// [end] GA Tag
function getURLParam(param) {
return new URL(window.location.href).searchParams.get(param);
}
if (getURLParam('dev') === null) {
ECommerce.clickEvent();
}
</script>
<title>BR2SQL free translate business rules into SQL create relational database DDL scripts</title>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "SoftwareApplication",
"name": "BR2SQL",
"operatingSystem": "Any",
"applicationCategory": "BusinessApplication",
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "5.0",
"ratingCount": "1"
},
"offers": {
"@type": "Offer",
"price": "0.00",
"priceCurrency": "USD"
}
}
</script>
<meta name="title" content="BR2SQL free translate business rules into SQL create relational database DDL scripts">
<meta name="description" content="Translate natural language business rules into SQL DDL database creation scripts ONLINE FOR FREE. Ready data types, primary and foreign keys, and unique indexes for database tables.">
<meta property="og:type" content="website">
<meta property="og:title" content="BR2SQL free translate business rules into SQL create relational database DDL scripts">
<meta property="og:description" content="Translate natural language business rules into SQL DDL database creation scripts ONLINE FOR FREE. Ready data types, primary and foreign keys, and unique indexes for database tables.">
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:title" content="BR2SQL free translate business rules into SQL create relational database DDL scripts">
<meta property="twitter:description" content="Translate natural language business rules into SQL DDL database creation scripts ONLINE FOR FREE. Ready data types, primary and foreign keys, and unique indexes for database tables.">
<meta name="keywords" content="translate business rules natural language SQL relational database create scripts DDL free online">
<meta name="robots" content="index, follow">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="language" content="English">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Font -->
<link href="https://fonts.googleapis.com/css?family=Kanit" rel="stylesheet" />
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<link rel="icon" type="image/png" href="/images/br2sql/logo.png" />
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8990058470889069" crossorigin="anonymous"></script>
<!-- Styles -->
<style>
body {
font-family: 'Kanit', sans-serif;
background: rgb(234, 255, 221);
background: radial-gradient(circle, rgba(234, 255, 221, 0.4) 0%, rgba(191, 255, 232, 0.4) 100%);
}
.banner-img {
width: 40%;
}
.btn {
background-color: #92E3A9;
border-color: #92E3A9;
font-weight: bold;
}
#sql-output {
height: 560px;
text-align: left;
}
</style>
<link rel="stylesheet" href="https://unpkg.com/@highlightjs/cdn-assets@11.2.0/styles/default.min.css">
</head>
<body id="app">
<nav class="navbar sticky-top navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="javascript:void(0);"><b>BR2SQL</b></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<div class="ml-2 mr-2" id="google_translate_element"></div>
</li>
<li class="nav-item">
<a class="nav-link" href="#app">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#tryArea">Generate SQL</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#testArea">Examples</a>
</li>
</ul>
</div>
</nav>
<div class="text-center ml-4 mr-4 mt-4 mb-4">
<div style="transform: scale(1);" class="mb-4"><svg width="300" height="238.05005362882054" viewBox="0 0 300 238.05005362882054" class="css-1j8o68f"><defs id="SvgjsDefs2211"></defs><g id="SvgjsG2212" featurekey="e7LhAk-0" transform="matrix(1.72539726181996,0,0,1.72539726181996,63.698647605985855,-11.301352394014149)" fill="#92E3A9"><g xmlns="http://www.w3.org/2000/svg" transform="matrix( 1, 0, 0, 1, 0,0) "><g><g><path d="M92.646,87.838c0.574-0.561,0.854-1.204,0.84-1.932c0-0.785-0.279-1.449-0.84-1.996L67.09,58.355 c3.836-5.572,5.754-11.809,5.754-18.712c0-4.423-0.846-8.644-2.541-12.662c-1.637-4.033-4.045-7.616-7.223-10.752 c-3.15-3.107-6.721-5.5-10.71-7.181C48.338,7.383,44.097,6.55,39.645,6.55c-4.41,0-8.651,0.833-12.726,2.499 c-3.99,1.681-7.552,4.074-10.689,7.182c-3.135,3.108-5.537,6.692-7.203,10.751C7.376,31,6.55,35.221,6.55,39.645 c0,4.452,0.826,8.694,2.478,12.726c1.666,4.06,4.067,7.637,7.203,10.73V63.08c3.137,3.178,6.699,5.586,10.688,7.223 c4.06,1.693,8.302,2.541,12.726,2.541c6.832,0,13.062-1.924,18.689-5.774L83.91,92.646c0.52,0.561,1.162,0.84,1.934,0.84 c0.84,0,1.498-0.287,1.973-0.861L92.646,87.838 M58.523,20.788c0.006,0.008,0.013,0.015,0.021,0.021 c2.512,2.54,4.443,5.411,5.796,8.608l0.021,0.021c1.316,3.25,1.973,6.652,1.973,10.206c0,3.594-0.658,7.023-1.973,10.29 c-0.004,0.009-0.012,0.015-0.021,0.021c-1.355,3.219-3.294,6.075-5.816,8.569v0.021c-2.545,2.512-5.429,4.444-8.653,5.796 l-0.021,0.021c-3.236,1.314-6.638,1.973-10.206,1.973c-3.554,0-6.956-0.656-10.206-1.973l-0.021-0.021 c-3.198-1.353-6.068-3.285-8.608-5.796l-0.021-0.021c-2.511-2.499-4.443-5.391-5.796-8.674v0.021 c-1.342-3.246-2.014-6.654-2.016-10.227c0.001-3.557,0.673-6.959,2.016-10.205c1.352-3.21,3.283-6.086,5.796-8.63 c0.006-0.006,0.015-0.013,0.021-0.021c2.543-2.484,5.42-4.396,8.63-5.733c3.246-1.343,6.648-2.015,10.206-2.016 c3.572,0.002,6.981,0.674,10.227,2.016H49.85C53.085,16.393,55.976,18.303,58.523,20.788z"></path></g></g></g><g xmlns="http://www.w3.org/2000/svg" transform="matrix( 1, 0, 0, 1, 0,0) "><g><g><path d="M42.584,24.693c-0.014-0.015-0.028-0.028-0.042-0.042c-1.162-1.148-2.562-1.722-4.2-1.722 c-1.624,0-3.017,0.582-4.179,1.744h-0.021c-1.148,1.162-1.723,2.562-1.723,4.2c0,0.793,0.133,1.528,0.399,2.205l-6.047,6.068 c-0.919-0.489-1.94-0.735-3.066-0.735c-1.805,0-3.345,0.644-4.62,1.932c-1.288,1.274-1.931,2.82-1.931,4.641 c0,1.82,0.643,3.375,1.931,4.663c1.274,1.26,2.814,1.889,4.62,1.889c1.834,0,3.388-0.63,4.663-1.889h0.021 c1.274-1.288,1.911-2.843,1.911-4.663c0-1.122-0.245-2.144-0.735-3.066l5.879-5.858c0.866,0.49,1.832,0.735,2.898,0.735 c1.159,0,2.202-0.288,3.129-0.862l5.986,5.985c-0.504,0.926-0.756,1.948-0.756,3.066c0,1.807,0.657,3.36,1.973,4.662 c1.274,1.261,2.821,1.89,4.641,1.89s3.366-0.63,4.641-1.89c1.274-1.288,1.911-2.842,1.911-4.662c0-1.11-0.237-2.117-0.715-3.024 l3.97-3.969c-0.229-1.526-0.606-3.017-1.133-4.473l-5.629,5.627c-0.913-0.49-1.928-0.735-3.045-0.735 c-1.12,0-2.143,0.246-3.065,0.735l-6.299-6.32c0.21-0.604,0.315-1.256,0.315-1.953C44.265,27.248,43.705,25.855,42.584,24.693 M56.57,42.983c0,0.91-0.315,1.687-0.945,2.331c-0.63,0.616-1.4,0.924-2.311,0.924s-1.688-0.315-2.33-0.945 c-0.658-0.644-0.987-1.414-0.987-2.31c0-0.91,0.329-1.687,0.987-2.331c0.658-0.643,1.435-0.966,2.33-0.966 c0.883,0,1.652,0.322,2.311,0.966C56.255,41.296,56.57,42.074,56.57,42.983 M36.495,26.982c0.504-0.518,1.12-0.778,1.849-0.778 c0.714,0,1.336,0.259,1.868,0.778l0.021,0.021c0.504,0.518,0.756,1.141,0.756,1.869s-0.246,1.351-0.735,1.869 c-0.015,0-0.028,0.007-0.042,0.021c-0.518,0.49-1.141,0.736-1.869,0.736c-0.728,0-1.344-0.246-1.849-0.736l-0.021-0.021 c-0.504-0.518-0.756-1.141-0.756-1.869c0-0.728,0.259-1.351,0.777-1.869L36.495,26.982 M21.417,45.314l-0.021-0.021 c-0.63-0.63-0.945-1.4-0.945-2.31c0-0.924,0.321-1.7,0.966-2.331c0.63-0.643,1.393-0.966,2.289-0.966 c0.91,0,1.694,0.322,2.352,0.966c0.63,0.644,0.945,1.421,0.945,2.331c0,0.91-0.315,1.681-0.945,2.31v0.021 c-0.644,0.616-1.428,0.924-2.352,0.924C22.811,46.238,22.047,45.93,21.417,45.314z"></path></g></g></g></g><g id="SvgjsG2213" featurekey="Qg0WB5-0" transform="matrix(3.716550984430062,0,0,3.716550984430062,-5.94648166369758,152.04905902875313)" fill="#111111"><path d="M1.6 5.609999999999999 q0 -0.21 0.115 -0.335 t0.325 -0.125 l6.64 0 q0.88 0 1.66 0.335 t1.365 0.92 t0.925 1.37 t0.34 1.685 q0 0.75 -0.235 1.395 t-0.665 1.155 q0.72 0.66 1.14 1.57 t0.42 1.93 q0 0.91 -0.35 1.725 t-0.945 1.43 t-1.39 0.975 t-1.675 0.36 l-7.23 0 q-0.2 0 -0.32 -0.105 t-0.12 -0.325 l0 -13.96 z M9.66 15.36 q0 -0.3 -0.115 -0.6 t-0.32 -0.535 t-0.49 -0.385 t-0.615 -0.15 l-2.64 0 l0 3.34 l2.64 0 q0.33 0 0.61 -0.14 t0.49 -0.375 t0.325 -0.535 t0.115 -0.62 z M9.13 9.55 q0 -0.3 -0.11 -0.56 t-0.31 -0.46 t-0.48 -0.315 t-0.61 -0.115 l-2.14 0 l0 2.9 l2.11 0 q0.34 0 0.625 -0.105 t0.485 -0.3 t0.315 -0.46 t0.115 -0.585 z M15.73 5.609999999999999 q0 -0.21 0.11 -0.335 t0.33 -0.125 l6.46 0 q1.03 0 1.93 0.385 t1.57 1.045 t1.055 1.545 t0.385 1.885 q0 0.68 -0.185 1.295 t-0.515 1.15 t-0.785 0.97 t-0.995 0.745 l2.57 4.84 q0.07 0.14 0.18 0.33 t0.11 0.33 q0 0.16 -0.105 0.245 t-0.285 0.085 l-3.43 0 q-0.17 0 -0.305 -0.1 t-0.175 -0.27 l-2.43 -4.57 l-1.62 0 l0 4.51 q0 0.43 -0.46 0.43 l-2.97 0 q-0.2 0 -0.32 -0.105 t-0.12 -0.325 l0 -13.96 z M23.560000000000002 10.05 q0 -0.3 -0.11 -0.6 t-0.31 -0.55 t-0.48 -0.42 t-0.62 -0.22 q-0.28 -0.02 -0.525 -0.035 t-0.535 -0.015 l-1.38 0 l0 3.67 l1.84 0 q0.18 0 0.32 -0.01 t0.31 -0.03 q0.35 -0.04 0.63 -0.205 t0.47 -0.41 t0.29 -0.55 t0.1 -0.625 z M34.72 16.71 l4.5 0 q0.2 0 0.33 0.11 t0.13 0.34 l0 2.33 q0 0.19 -0.135 0.35 t-0.335 0.16 l-9.21 0 q-0.19 0 -0.35 -0.155 t-0.16 -0.355 l0 -1.49 q0 -0.14 0.07 -0.27 l6.07 -7.25 q0.27 -0.31 0.34 -0.53 t0.07 -0.49 q0 -0.34 -0.13 -0.6 t-0.34 -0.435 t-0.47 -0.265 t-0.53 -0.09 q-0.3 0 -0.565 0.12 t-0.465 0.325 t-0.32 0.47 t-0.12 0.545 l0 0.55 q0 0.16 -0.13 0.32 t-0.37 0.16 l-2.56 0 q-0.25 0 -0.345 -0.135 t-0.095 -0.285 l0 -0.52 q0 -1.05 0.39 -1.925 t1.06 -1.505 t1.56 -0.98 t1.9 -0.35 q1.03 0 1.97 0.325 t1.655 0.92 t1.14 1.44 t0.425 1.895 q0 0.54 -0.13 1.015 t-0.345 0.895 t-0.49 0.785 t-0.575 0.695 z M44.559999999999995 15.21 q0.17 0.14 0.435 0.375 t0.605 0.465 q0.51 0.34 1.01 0.53 t1.05 0.19 q0.51 0 0.855 -0.115 t0.545 -0.305 t0.285 -0.44 t0.085 -0.53 q0 -0.31 -0.235 -0.555 t-0.575 -0.435 t-0.71 -0.325 t-0.64 -0.225 q-1.2 -0.42 -2.1 -0.905 t-1.5 -1.08 t-0.9 -1.31 t-0.3 -1.595 q0 -0.93 0.375 -1.69 t1.07 -1.3 t1.675 -0.835 t2.19 -0.295 q0.91 0 1.745 0.205 t1.645 0.655 q0.34 0.2 0.645 0.415 t0.535 0.415 t0.365 0.38 t0.135 0.31 t-0.065 0.24 t-0.195 0.25 l-1.53 1.63 q-0.17 0.17 -0.34 0.17 q-0.14 0 -0.255 -0.08 t-0.255 -0.2 l-0.09 -0.08 q-0.2 -0.17 -0.445 -0.35 t-0.525 -0.325 t-0.59 -0.24 t-0.63 -0.095 q-0.33 0 -0.62 0.055 t-0.51 0.175 t-0.35 0.315 t-0.13 0.475 t0.14 0.485 t0.42 0.38 t0.695 0.33 t0.965 0.335 q1.06 0.35 1.955 0.735 t1.545 0.91 t1.015 1.255 t0.365 1.77 q0 1.1 -0.45 1.995 t-1.235 1.525 t-1.845 0.975 t-2.28 0.345 q-1.15 0 -2.26 -0.41 t-2.07 -1.1 q-0.4 -0.29 -0.675 -0.57 t-0.435 -0.45 l-0.03 -0.03 q-0.01 -0.02 -0.02 -0.025 t-0.02 -0.015 q-0.01 -0.02 -0.02 -0.025 t-0.02 -0.015 q-0.23 -0.25 -0.23 -0.4 q0 -0.17 0.23 -0.38 l1.73 -1.65 q0.21 -0.15 0.34 -0.15 q0.09 0 0.19 0.06 t0.24 0.18 z M55.120000000000005 12.59 q0 -1.06 0.27 -2.035 t0.77 -1.83 t1.195 -1.555 t1.545 -1.195 t1.825 -0.77 t2.035 -0.275 q1.05 0 2.03 0.275 t1.83 0.77 t1.55 1.195 t1.195 1.555 t0.77 1.83 t0.275 2.035 q0 1.35 -0.43 2.57 t-1.195 2.195 t-1.82 1.66 t-2.305 0.975 l0 2.71 q0 0.44 -0.48 0.44 l-2.95 0 q-0.44 0 -0.44 -0.44 l0 -2.73 q-1.24 -0.3 -2.28 -0.985 t-1.795 -1.655 t-1.175 -2.18 t-0.42 -2.56 z M58.980000000000004 12.58 q0 0.83 0.28 1.55 t0.785 1.255 t1.195 0.84 t1.52 0.305 t1.525 -0.305 t1.2 -0.84 t0.785 -1.255 t0.28 -1.55 q0 -0.82 -0.28 -1.545 t-0.785 -1.265 t-1.2 -0.85 t-1.525 -0.31 t-1.52 0.31 t-1.195 0.85 t-0.785 1.265 t-0.28 1.545 z M72.51 5.58 q0 -0.18 0.12 -0.31 t0.33 -0.13 l2.96 0 q0.17 0 0.31 0.12 t0.15 0.32 l0 10.88 l5.5 0 q0.18 0 0.31 0.12 t0.13 0.33 l0 2.63 q0 0.17 -0.115 0.31 t-0.325 0.15 l-8.93 0 q-0.44 0 -0.44 -0.44 l0 -13.98 z"></path></g></svg></div>
<h1>BR2SQL free translate business rules into SQL create relational database DDL scripts</h1>
<h3>Translate natural language business rules into SQL DDL database creation scripts ONLINE FOR FREE. Ready data types, primary and foreign keys, and unique indexes for database tables.</h3>
<a href="#tryArea" class="btn btn-lg mt-4" role="button">TRY FOR FREE</a>
<a href="#testArea" class="btn btn-lg mt-4" role="button">TEST ON SOL<img src="images/br2sql/slrn.png" style="width: 16px; padding-bottom: 4px; margin-left: 2px; margin-right: 2px;">LEARN PUZZLES</a>
<br>
<img src="/images/br2sql/server-bro.png" class="img-fluid banner-img mt-4" alt="data-pana.png">
<p class="text-muted">In the recent decades data has indeed become one of the most valuable assets for government institutions, private businesses, and individual persons. Nowadays almost any software, from social networks and dating mobile applications to large information
systems and analytical services for enterprise management, accumulates, stores, and processes data to solve certain problems in their subject areas. Extremely large data volumes are organized in databases that are used as the baseline for
almost all of modern software applications. As the most important components of software systems, databases should be carefully designed, since drawbacks at the stage of requirements elicitation may result in exponential growth of defects
fixing costs at testing and maintenance phases. Therefore, we propose an approach and software tool to database schema generation from textual requirements also known in database design domain as business rules.</p>
<p class="text-muted">This may help database designers to rapidly obtain usable database schemas in order to detect and fix defects as early as possible. Moreover, proposed solution may simplify the database design process, since database creation scripts are generated
from business rules directly. Thus, instead of coding all the required statements, engineers are only need to check obtained schema and make certain adjustments to data types, unique attributes, or used naming style. This tool considers relational
model and relational databases, since they are most widely used nowadays.</p>
<span id="tryArea"></span>
<br>
<br>
<br>
<h4 style="font-weight: bold;" class="text-muted mt-4">GENERATE SOL</h4>
<div class="row mt-4">
<div class="col-sm-4">
<a href="#tryArea" class="btn btn-sm mb-2" onclick="displayExample();" role="button">BUSINESS RULES EXAMPLE</a>
<div class="form-group mb-2">
<label for="db-name" class="text-muted">Database Name</label>
<input type="text" class="form-control" id="db-name" placeholder="Database Name">
</div>
<div class="form-group mb-2">
<label for="rules-input" class="text-muted">Business Rules</label>
<p>
<span><b>Attributes:</b> Each <i>entity name</i> has <i>attribute</i>, <i>attribute</i>, ..., <i>attribute</i>.</span>
<span><b>e.g.:</b> Each student has full name, student card id, birth date, enrollment date.</span>
<br>
<span><b>Relationships:</b> (Each | Some) <i>entity name</i> is <i>relationship description</i> (one | many) <i>entity name</i>.</span>
<span><b>e.g.:</b> Each student is given by many score.</span>
</p>
<textarea class="form-control" id="rules-input" rows="6" placeholder="Business Rules"></textarea>
</div>
<div class="form-check mb-2">
<input class="form-check-input" type="checkbox" id="drop-db" checked>
<label class="form-check-label" for="drop-db">Include DROP DATABASE Scripts</label>
</div>
<div class="form-check mb-2">
<input class="form-check-input" type="checkbox" id="create-db" checked>
<label class="form-check-label" for="create-db">Include CREATE DATABASE Scripts</label>
</div>
<a href="javascript:void(0);" class="btn btn-sm mb-2" onclick="translateIntoSQL();" role="button">TRANSLATE INTO SQL</a>
</div>
<div class="col-sm-8">
<div class="form-group">
<label for="sql-output" class="text-muted">SQL Output (copy, paste, adjust, and deploy to the MySQL/MariaDB database server)</label>
<pre id="code-area"><code class="language-sql" id="sql-output"></code></pre>
</div>
</div>
</div>
<span id="testArea"></span>
<br>
<br>
<br>
<h4 style="font-weight: bold;" class="text-muted mt-4">TEST ON SOL<img src="images/br2sql/slrn.png" style="width: 18px; padding-bottom: 5px; margin-left: 2px; margin-right: 2px;">LEARN PUZZLES</h4>
<div class="container">
<!-- [start] test #1 -->
<div class="row mt-4">
<div class="col-sm-12">
<h5 style="font-weight: bold;">Test #1: Products</h5>
<p>When buying food, it is important to make sure it is fresh and not expired. You are given the following 'Products' list. Write a query to select the ProductName, ProductionDate and ExpirationDate. Use the SELECT statement and separate
the required columns by commas.</p>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<textarea class="form-control" id="test1-input" rows="10" readonly>Each product has product name, price, production date, expiration date.</textarea>
</div>
<div class="col-sm-6">
<pre id="code-area"><code class="language-sql" id="test1-output" style="height: 255px; text-align: left;"></code></pre>
</div>
</div>
<!-- [end] test #1 -->
<!-- [start] test #2 -->
<div class="row mt-4">
<div class="col-sm-12">
<h5 style="font-weight: bold;">Test #2: Cakes</h5>
<p>A local bakery creates unique cake sets. Each cake set contains three different cakes. Here is the cakes table. Today a customer want a cake set that has minimal calories. Write a query to sort the cakes by calorie count and select
the first 3 cakes from the list to offer the customer. Try to combine ORDER BY and LIMIT keywords.</p>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<textarea class="form-control" id="test2-input" rows="10" readonly>Each cake has name, calories amount.</textarea>
</div>
<div class="col-sm-6">
<pre id="code-area"><code class="language-sql" id="test2-output" style="height: 255px; text-align: left;"></code></pre>
</div>
</div>
<!-- [end] test #2 -->
<!-- [start] test #3 -->
<div class="row mt-4">
<div class="col-sm-12">
<h5 style="font-weight: bold;">Test #3: Apartments</h5>
<p>You want to rent an apartment and have the following table named Apartments. Write a query to output the apartments whose prices are greater than the average and are also not rented, sorted by the 'Price' column. Recall the AVG keyword.</p>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<textarea class="form-control" id="test3-input" rows="10" readonly>Each apartment has city, address, price, status.</textarea>
</div>
<div class="col-sm-6">
<pre id="code-area"><code class="language-sql" id="test3-output" style="height: 255px; text-align: left;"></code></pre>
</div>
</div>
<!-- [end] test #3 -->
<!-- [start] test #4 -->
<div class="row mt-4">
<div class="col-sm-12">
<h5 style="font-weight: bold;">Test #4: Zoo</h5>
<p>You manage a zoo. Each animal in the zoo comes from a different country. Here are the tables you have: Animals and Countries. 1) A new animal has come in, with the following details: name - "Slim", type - "Giraffe", country_id – 1
Add him to the Animals table. 2) You want to make a complete list of the animals for the zoo's visitors. Write a query to output a new table with each animal's name, type and country fields, sorted by countries. Recall INSERT and
INNER JOIN keywords.</p>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<textarea class="form-control" id="test4-input" rows="10" readonly>Each animal has name, type. Each country has name. Each country is a home for many animal.</textarea>
</div>
<div class="col-sm-6">
<pre id="code-area"><code class="language-sql" id="test4-output" style="height: 255px; text-align: left;"></code></pre>
</div>
</div>
<!-- [end] test #4 -->
</div>
<img src="/images/br2sql/server-amico.png" class="img-fluid banner-img mt-4" alt="data-amico.png">
</div>
<div class="modal fade" id="messageModal" tabindex="-1" role="dialog" aria-labelledby="messageModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="messageModalLabel"><b>Message</b></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
</div>
<div class="modal-body" id="message-text"></div>
</div>
</div>
</div>
<div class="jumbotron jumbotron-fluid text-muted" id="footer">
<div class="ml-4">
<b>BR2SQL</b> by <a href="/index.html" target="_blank"><b>freebpmnquality</b></a>, 2020 -
<script>
document.write(new Date().getFullYear())
</script> <a href="https://creativecommons.org/licenses/by-nd/4.0/" target="_blank">(CC BY-ND)</a>, <a href="/privacy-policy.html" target="_blank">Privacy Policy</a>
</div>
</div>
<!-- Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<script src="https://unpkg.com/@highlightjs/cdn-assets@11.2.0/highlight.min.js"></script>
<script src="https://unpkg.com/@highlightjs/cdn-assets@11.2.0/languages/go.min.js"></script>
<!-- App -->
<script src="/js/br2sql.js"></script>
<script type="text/javascript">
function displayMessage(messageText) {
$('#message-text').html(messageText);
$('#messageModal').modal('show');
}
function displayExample() {
$('#db-name').val('Students');
$('#rules-input').val(`Each student has full name, student card ID, birth date, enrollment date. Each student is given by many score. Each course has title, semester number, approval date. Each course is evaluated by many score. Each score has ECTS mark, points amount, completion date.`);
}
function translateIntoSQL() {
brToSQLTranslator.dbName = $('#db-name').val();
brToSQLTranslator.businessRulesText = $('#rules-input').val();
if (brToSQLTranslator.dbName.length < 1) {
displayMessage('Database name is missing!');
} else if (brToSQLTranslator.businessRulesText < 1) {
displayMessage('Business rules are missing!');
} else {
brToSQLTranslator.extractBusinessRules();
brToSQLTranslator.businessRulesToTables();
brToSQLTranslator.tablesToSQL($('#drop-db').is(':checked'), $('#create-db').is(':checked'));
$('#sql-output').text(brToSQLTranslator.script);
hljs.highlightAll();
}
}
function translateTests() {
const testNumber = 4;
const testDbs = ['products', 'cakes', 'apartments', 'zoo'];
for (let num = 1; num <= testNumber; num++) {
brToSQLTranslator.dbName = testDbs[num - 1];
brToSQLTranslator.businessRulesText = $(`#test${num}-input`).val();
brToSQLTranslator.extractBusinessRules();
brToSQLTranslator.businessRulesToTables();
brToSQLTranslator.tablesToSQL(false, false);
$(`#test${num}-output`).text(brToSQLTranslator.script);
hljs.highlightAll();
}
}
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'en'
}, 'google_translate_element');
}
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function(e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
block: 'start',
behavior: 'smooth'
});
});
});
$(document).ready(function() {
displayExample();
translateIntoSQL();
translateTests();
});
</script>
<script type="text/javascript" src="https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
</body>
</html>