4 ms·
If you exploring a set of tables you have never touched before, it really neat if you could just type in: FROM tablename t SELECT t.<press tab> and some form
by spprashant 4y ago
If you exploring a set of tables you have never touched before, it really neat if you could just type in:
FROM tablename t
SELECT t.<press tab>
and some form of autocomplete mechanism, either prefills all the column names from table "t" or suggests the list of columns and/or types associated with it.
This is much better than having to:
1. Run a SELECT with LIMIT statement just to get an idea of the layout.
2. Point and click through the IDE treeview.
Honestly, I don't think it helps a whole lot beyond this functionality, but I can see why folks who are accustomed to thinking in functional pipelines (from -> select -> map -> filter -> collect) can prefer this way of querying.
I think PRQL is one attempt at building something this way.[1]
[1]. https://github.com/prql/prql https://github.com/prql/prql
- noirscape 4y agoDESCRIBE TABLE is a command that pretty much does exactly this (explain what a table contains) and it's a part of MySQL. If you use PostgreSQL then you can use \d instead. I'm sure the other RDBMSes have their own equivalent (except for maybe SQLite but if you're using SQLite outside of toy environments or hobby projects, you're doing it wrong).
- ldldldk 4y agoSQLite absolutely has production level applications, it's much more than a toy. https://www.sqlite.org/whentouse.html https://www.sqlite.org/whentouse.html
- john61 4y agoin sqlite3 it is .schema
- The_Colonel 4y agoIt's kind of funny to see a claim that the most widely deployed database in the world is useful only for toy projects. https://www.sqlite.org/mostdeployed.html https://www.sqlite.org/mostdeployed.html
- bot41 4y agosheesh lets hope there are no vulnerabilities in there
- colejohnson66 4y agoSQLite has an 608 times more lines of code for tests than the original code![0] I’d wager it’s the highest test/production ratio there is. [0]: https://www.sqlite.org/testing.html https://www.sqlite.org/testing.html
- The_Colonel 4y agoMost of those tests are generated. It's wrong to focus on this metric IMO.
- colejohnson66 4y agoAuto generated or not, the point being made, in regards to @bot41's comment, was that SQLite is thoroughly tested.
- The_Colonel 4y agoIt's well tested, but that's still not a guarantee that there are no security issues. Latest acknowledged CVE bug is a month old: https://www.sqlite.org/cves.html https://www.sqlite.org/cves.html
- bmacho 4y agoI guess there are more toy projects than serious ones.
- The_Colonel 4y agoYeah, I mean MacOS, Android, iOS, Chrome, Firefox ... all typical toy projects.
- __float 4y agoThis may be true, but you've missed the point that this is about aiding autocompletion while you're writing the query the first time.
- bombcar 4y agoCouldn’t the IDEA understand FROM table SELECT And when done switch the code to be correct?
- andy81 4y agoEvery RDMBS has this, including SQLite.
- tremon 4y agoYou're missing the point: until you have typed the FROM TableName t in your IDE, SELECT t.<press tab> can not do autocompletion. That has nothing to do with whether SQL supports querying metadata (the ANSI portable way would be through INFORMATION_SCHEMA btw, not DESCRIBE). It's a consequence of the brain not responding to think-ahead queries by the IDE.
- jjav 4y ago> except for maybe SQLite .schema > if you're using SQLite outside of toy environments or hobby projects, you're doing it wrong That's an uninformed statement. SQLite is extremely solid production quality code. Of course it's not the universally applicable database solution, nothing is. Sometimes you need Cassandra or its kind, often MySQL|Postgres, other times SQLite is the correct answer.
- matheusmoreira 4y ago> if you're using SQLite outside of toy environments or hobby projects, you're doing it wrong https://www.sqlite.org/mostdeployed.html https://www.sqlite.org/mostdeployed.html > Every Android device > Every iPhone and iOS device > Every Mac > Every Windows 10 machine > Every Firefox, Chrome, and Safari web browser > Every instance of Skype > Every instance of iTunes > Every Dropbox client > Every TurboTax and QuickBooks > PHP and Python > Most television sets and set-top cable boxes > Most automotive multimedia systems > Countless millions of other applications Look at all those toys.
- emptyparadise 4y agoeveryone is doing it wrong :(
- ErwinSmout 4y agoNot necessarily. If you ponder the importance of proper (robust, reliable, dependable) data management for data that keeps nuclear plants going, for farmaceutical research data, for anything happening on the financial markets, for medical records, for data concerning payroll and the like, etc. etc. then you might appreciate that all the stuff mentioned in the list is indeed really "just toys".
- andylynch 4y agoIn SSMS and almost certainly many other SQL editors Intellisense works on the select list as soon as you have a working from clause, the only caveat being you can’t autocomplete columns reading when writing a statement purely left to right. But I think that’s not a big deal at all, and the SQL approach has a certain advantage in putting the type of action (select/update/delete/drop etc) front and centre, which is really quite helpful.
- tomjakubowski 4y agoSELECT FROM widgets VALUES id, factory_origin_id, frobbable_knobs