Anonymous user
Table creation: Difference between revisions
Added Julia language
(Corrected Library tag) |
(Added Julia language) |
||
Line 97:
Also, a properly tuned system would likely use different code (for example, you could get better performance if you put an entire column into a box instead of introducing a new box for each element in a column).
=={{header|Julia}}==
{{works with|Julia|0.6}}
<lang julia>using SQLite
conn = SQLite.DB() # in-memory
SQLite.execute!(conn, """
create table stocks
(date text, trans text, symbol text,
qty real, price real)
""")
# Insert a row of data
SQLite.execute!(conn, """
insert into stocks
values ('2006-01-05','BUY','RHAT',100,35.14)
""")
for v in [["2006-03-28", "BUY", "IBM", 1000, 45.00],
["2006-04-05", "BUY", "MSOFT", 1000, 72.00],
["2006-04-06", "SELL", "IBM", 500, 53.00]]
SQLite.query(conn, "insert into stocks values (?,?,?,?,?)", values = v)
end
df = SQLite.query(conn, "select * from stocks order by price")
println(df)</lang>
{{out}}
<pre>4×5 DataFrames.DataFrame
│ Row │ date │ trans │ symbol │ qty │ price │
├─────┼──────────────┼────────┼─────────┼────────┼───────┤
│ 1 │ "2006-01-05" │ "BUY" │ "RHAT" │ 100.0 │ 35.14 │
│ 2 │ "2006-03-28" │ "BUY" │ "IBM" │ 1000.0 │ 45.0 │
│ 3 │ "2006-04-06" │ "SELL" │ "IBM" │ 500.0 │ 53.0 │
│ 4 │ "2006-04-05" │ "BUY" │ "MSOFT" │ 1000.0 │ 72.0 │</pre>
=={{header|FunL}}==
|