57 lines
1.4 KiB
HTML
Executable File
57 lines
1.4 KiB
HTML
Executable File
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<script src="../../js/codemirror.js" type="text/javascript"></script>
|
|
<title>CodeMirror: SQL demonstration</title>
|
|
<link rel="stylesheet" type="text/css" href="../../css/docs.css"/>
|
|
</head>
|
|
<body style="padding: 20px;">
|
|
|
|
<p>Demonstration of <a href="../../index.html">CodeMirror</a>'s SQL
|
|
highlighter.</p>
|
|
|
|
<p>Written by John Benediktsson (<a href="LICENSE">license</a>).</p>
|
|
|
|
<div style="border-top: 1px solid black; border-bottom: 1px solid black;">
|
|
<textarea id="code" cols="120" rows="50">
|
|
create table if not exists table1(
|
|
a bigint(13) not null primary key,
|
|
b char(4) not null,
|
|
c char(50) not null,
|
|
d int(9) not null,
|
|
);
|
|
|
|
insert into table1 values (1234567890123, "b", "c", 0);
|
|
|
|
select from_unixtime(a/1000), b, c, min(d) as `using`
|
|
from table1 t1
|
|
left join table2 t2 using (a)
|
|
-- inner join table3 t3 on t3._a = t1.a
|
|
join (
|
|
select a, b, c
|
|
from data
|
|
) as foo on foo.a = t1.a
|
|
|
|
where a > 10
|
|
and b like '%foo'
|
|
or c = 3.14159
|
|
and d < -15.7
|
|
order by 1 desc
|
|
;
|
|
|
|
select @total := sum(d) from data;
|
|
</textarea>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
var editor = CodeMirror.fromTextArea('code', {
|
|
height: "450px",
|
|
parserfile: "../contrib/sql/js/parsesql.js",
|
|
stylesheet: "css/sqlcolors.css",
|
|
path: "../../js/",
|
|
textWrapping: false
|
|
});
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|