5 ms·
At my office a lot of the non-programmers (marketers, finance people, customer support, etc) write a fair bit of SQL. I've often wondered what it is about SQL t
by losvedir 10y ago
At my office a lot of the non-programmers (marketers, finance people, customer support, etc) write a fair bit of SQL. I've often wondered what it is about SQL that allows them to get over their fear of programming, since they would never drop into ruby or a "real" programming language. Things I've considered:
* Graphical programming environment (they run the queries
from pgadmin, or Postico, or some app like that)
* Instant feedback - run the query get useful results
* Compilation step with some type safety - will complain
if their query is malformed
* Are tables a "natural" way to think about data for humans?
* Job relevance
Any ideas? Can we learn from that example to make real programming environments that are more "cross functional" in that more people in a company are willing to use them?
- mtrn 10y agoJust a thought: Is it mostly select statements that your colleagues write? Because if they do, they might not fear accidentally altering the data. I found that new programmers can get confused by the difference between things that are immutable and those that aren't.
- edc117 10y agoWhy not ask them? It's an interesting question, and I've noticed similar things with business analysts I've worked with in the past.
- retroafroman 10y agoAs someone pretty close to this camp, it comes down to your last bullet point - needing to do it, in my opinion. A smaller subset of those people will also learn VBA for the same reason-it helps them get their job done. The benefit those two have is that they are either built in to the tools already (VBA), or a DBA does most of the set up and the used mostly just runs queries against it and doesn't have to worry too much about indexing, performance, schemas, etc (SQL). If I were to try to turn them onto python, it'd be an effort to get it installed and then get them to use the commandline.
- numlocked 10y agoSQL is declarative. Compare: for user in table_users: if user.is_active: return user.first_name; vs: SELECT first_name FROM users_table WHERE is_active It's unfortunate that the order of the clauses in SQL is "wrong" (e.g. you should say FROM, WHERE, SELECT: Define the universe of relevant data, filter it down, select what you care about), but it's still quite easy to wrap your mind around. You are asking the computer for something, and if you ask nicely, it tells you what you want to know. Compare that to procedural programming, where you are telling the computer what to do, and even if it does what you say, that may not have been what you actually wanted after all.
- niftich 10y agoAlong this point, C# and VB.NET have SQL-like expressions that can be used for processing, called LINQ [1]. They even get the order of the clauses correct! A feature like this may help your programmers who are used to thinking in terms of filter -> select -> order. [1] https://msdn.microsoft.com/en-us/library/bb397927.aspx https://msdn.microsoft.com/en-us/library/bb397927.aspx
- numlocked 10y agoYes! Absolutely what I was thinking of when I wrote this :) Getting that right is one of my favorite parts of LINQ.
- moosingin3space 10y agoEcto (Elixir) does the from-in-where syntax as well.
- macca321 10y agoIt may be that its easier for people to define the desired result set, then tweak the query until it gives them what they want.
- taneq 10y ago> Compare that to procedural programming, where you are telling the computer what to do, and even if it does what you say, that may not have been what you actually wanted after all. Procedural vs. functional phrasing in no way changes the basic fact that if you ask a computer the wrong question it'll give you the wrong result. "go through the list of all users and add the ones which are active to a new list" vs. "the list I want contains all active users from the list of all users"
- danso 10y agoI teach SQL to my journalism students. Example exercise: http://2015.padjo.org/tutorials/sql-walks/exploring-wsj-medicare-investigation-with-sql/ http://2015.padjo.org/tutorials/sql-walks/exploring-wsj-medi... My main reason for teaching it was that it was a skill that helped me immensely as a journalist, in terms of being able to do data analysis. Because I learned it relatively late in my career, I thought it'd be hard for the students but most of them are able to get it. Even though I use relatively little SQL in my day to day work, it's my favorite thing to teach to novices. First, it has a similar data model to spreadsheets, so it feels like a natural progression. Secondly, for many students, this is the first time that they'll have done "real" programming and the first time that they learn how to tell a computer to do something rather than learn how to use a computer. In Excel, for example, you double click a file and the entire thing opens. With SQL, you're required to not just specify the database and table, but also each and every column...it's annoying at first, but then you realize that there is power in being explicit. The main advantage of teaching SQL over, say R, as a first language is that SQL's declarative syntax is easy to follow AND you can do most of what you need with a limited subset of the language...for instance, I don't have to teach variables and loops and functions...which is good because I don't even know how to really do those in SQL (just haven't had the need when I can work from R or Pandas). When a beginner student fucks up a basic Python script, there are any number of reasons for the failure that is beyond the student's expected knowledge. When a novice student fucks up a SQL query...it's easier to blame the mistake on the student (e.g. Misspelling of names/syntax)
- nealmydataorg 10y agoWhat are the main factors which encourage (and are helpful) non-programmers to use SQL ? We provide low code platform (SQL) to organize data and build custom applications as per specific workflow requirements. We are assuming that teaching/educating/training combined with lots of sample SQL code with real world examples are helpful to non-programmers for using SQL. Sample SQL is available at https://mydataorganizer.com/MyDataOrganizer/QuarterDatesCalculations_MyDataOrganizer.html https://mydataorganizer.com/MyDataOrganizer/QuarterDatesCalc... Thanks, Neal
- 10y ago
- kamaal 10y ago>>I've often wondered what it is about SQL that allows them to get over their fear of programming Thats barely programming. Even by the most lenient definition what they do isn't programming. Firstly SQL's are a little like Excel Macros, they lower the barrier to entry to basic twiddling. Got a SQL client(Toad etc?)? you can throw a snippet or two quickly. Anything beyond that gets difficult. Tricky joins, sub queries, troubleshooting big queries, optimization problems etc etc. Beyond this writing re usable code, test discipline and a range of other tasks that make code run for years is what is your everyday work as a programmer. Sure you could saw a log of wood once a while, but don't confuse that for being a full time carpenter.
- aklemm 10y agoWith SQL, you get a complete solution to your problem immediately (the data you want is returned). So, high value return on effort motivates people to learn it.